public final Font getFont()
{
if (font == null)
{
if (parent != null)
{
return parent.getFont();
}
font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,
Font.SIZE_SMALL);
;
}
return font;
}
public final int getForeColor()
{
if (forecolor == -1)
{
if (parent != null)
{
return parent.getForeColor();
}
forecolor = 0;
}
return forecolor;
}
public Manager getParent()
{
return parent;
}
public void keyPressed(int keyCode)
{
}
public void keyReleased(int keyCode)
{
}
public void keyRepeated(int keyCode)
{
}
protected void moveFocus(boolean forward)
{
if (parent != null)
{
parent.moveFocus(forward);
}
}
// If the area is acting like a Canvas, call
// the real paint routine
protected void paint(Graphics g)
{
eraseBackground(g);
g.setColor(getForeColor());
g.setFont(getFont());
paintArea(g, true);
}
// The manager calls this paint routine on each of
// its children
public final void paint(Graphics g, boolean hasFocus)
{
int cx = g.getClipX();
int cy = g.getClipY();
int ch = g.getClipHeight();
int cw = g.getClipWidth();
Font f = g.getFont();
int col = g.getColor();
eraseBackground(g);
g.setClip(x, y, w, h);
g.setFont(getFont());
g.setColor(getForeColor());
paintArea(g, hasFocus);
g.setClip(cx, cy, cw, ch);
g.setFont(f);
g.setColor(col);
}
// Subclass implements to do actual painting
protected abstract void paintArea(Graphics g, boolean hasFocus);
// Repaint the area of the given child