package bounze;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.RenderingHints;
import java.util.Observable;
import java.util.Observer;
import javax.swing.JComponent;

@SuppressWarnings("serial")
public class ScorePanel extends JComponent implements Observer {

    private static final Color BACK = Color.BLACK;
    private static final Color LABEL = new Color(255, 255, 255);
    private static final Color FORE = new Color(0,  51, 153);

    private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 28);
    private static final int HEIGHT = 50;
    private static final int PAD = 5;

    private final Game game;

    public ScorePanel(Game game) {
        this.game = game;
        Dimension d = new Dimension((int) (Game.WIDTH * GamePanel.SCALE),
                                    HEIGHT);
        setPreferredSize(d);
        game.addObserver(this);
    }

    @Override
    public void paintComponent(Graphics graphics) {
        Graphics2D g = (Graphics2D) graphics;
        g.setColor(BACK);
        g.fillRect(0, 0, getWidth(), getHeight());

        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                           RenderingHints.VALUE_ANTIALIAS_ON);

        String score = "" + game.getScore();
        String shots = "" + game.getShots();
        String level = "" + game.getLevel();

        g.setFont(FONT);
        FontMetrics fm = g.getFontMetrics();
        g.setColor(FORE);
        g.drawString(score, PAD, HEIGHT - PAD);
        g.drawString(level, getWidth() / 2 - fm.stringWidth(level) / 2,
                     HEIGHT - PAD);
        g.drawString(shots, getWidth() - PAD - fm.stringWidth(shots),
                     HEIGHT - PAD);
    }

    @Override
    public void update(Observable o, Object arg) {
        repaint();
    }
}

@@ -10,16 +10,45 @@
 ounze;%0A%0A
+import java.awt.BasicStroke;%0A
 import j
@@ -62,16 +62,16 @@
 .Color;%0A
-
 import j
@@ -226,16 +226,40 @@
 gHints;%0A
+import java.awt.Stroke;%0A
 import j
@@ -691,16 +691,109 @@
 N, 28);%0A
+    private static final Font LABEL_FONT%0A        = new Font(Font.SANS_SERIF, Font.BOLD, 12);%0A
     priv
@@ -865,16 +865,78 @@
 D = 5;%0A%0A
+    private static final Stroke STROKE = new BasicStroke(2);%0A%0A
     priv
@@ -1977,16 +1977,16 @@
 shots),%0A
-
         
@@ -2008,24 +2008,1031 @@
 IGHT - PAD);
+%0A%0A        String sscore = %22score%22;%0A        String slevel = %22level%22;%0A        String sshots = %22shots%22;%0A%0A        g.setColor(LABEL);%0A        g.setFont(LABEL_FONT);%0A        fm = g.getFontMetrics();%0A        g.drawString(sscore, PAD, fm.getAscent());%0A        g.drawString(slevel, getWidth() / 2 - fm.stringWidth(slevel) / 2,%0A                     fm.getAscent());%0A        g.drawString(sshots, getWidth() - PAD - fm.stringWidth(sshots),%0A                     fm.getAscent());%0A%0A        g.setStroke(STROKE);%0A        g.drawLine(PAD, fm.getAscent() + PAD,%0A                   2 * PAD + fm.stringWidth(slevel), fm.getAscent() + PAD);%0A        g.drawLine(getWidth() / 2 - fm.stringWidth(slevel) / 2 - PAD,%0A                   fm.getAscent() + PAD,%0A                   getWidth() / 2 + fm.stringWidth(slevel) / 2 + PAD,%0A                   fm.getAscent() + PAD);%0A        g.drawLine(getWidth() - 2 * PAD - fm.stringWidth(sshots),%0A                   fm.getAscent() + PAD,%0A                   getWidth() - PAD, fm.getAscent() + PAD);
 %0A    %7D%0A%0A    

Add labels.