
public void paintComponent (Graphics g) {
Graphics2D g2 = (Graphics2D)g;
String ss = "Pjw";
int baseline1 = 230;
int baseline2;
int x1=30, x2, y1, y2, y3, y4;
Font ft = new Font ("serif", Font.BOLD, 200);
FontMetrics fm = g.getFontMetrics (ft);
g.setFont (ft);
x2 = x1 + fm.stringWidth (ss);
y1 = baseline1 - fm.getAscent ();
y2 = baseline1 + fm.getDescent ();
y3 = baseline1 + fm.getDescent () + fm.getLeading ();
baseline2 = baseline1 + fm.getHeight();
y4 = baseline2 - fm.getAscent ();
g2.setPaint (new Color(0x000000));
g.drawString(ss,x1,baseline1);
g2.setPaint (new Color(0x000080));
g.drawLine(x1-20,y1,x2+20,y1);
g2.setPaint (new Color(0x0000FF));
g.drawLine(x1-20,baseline1,x2+20,baseline1);
g2.setPaint (new Color(0x008000));
g.drawLine(x1-20,y2,x2+20,y2);
g2.setPaint (new Color(0x00FF00));
g.drawLine(x1-20, y3, x2+20, y3);
g2.setPaint (new Color(0x606060));
g.drawString(ss, x1, baseline2);
g.drawLine(x1-20,baseline2,x2+20,baseline2);
g2.setPaint (new Color(0xFF0000));
g.drawLine (x2-20, y4, x2+20, y4);
g2.setPaint (new Color(0x800080));
g.drawLine (x1, y1-20, x1, y4+20);
g2.setPaint (new Color(0x008080));
g.drawLine (x2, y1-20, x2, y4+20);
}