98 |
*/ |
*/ |
99 |
transient Color highlight = Color.WHITE; |
transient Color highlight = Color.WHITE; |
100 |
|
|
|
/** The border around the ArrowButton. */ |
|
|
private transient Border buttonBorder = new Border() |
|
|
{ |
|
|
public Insets getBorderInsets(Component c) |
|
|
{ |
|
|
return new Insets(2, 2, 2, 2); |
|
|
} |
|
|
|
|
|
public boolean isBorderOpaque() |
|
|
{ |
|
|
return true; |
|
|
} |
|
|
|
|
|
public void paintBorder(Component c, Graphics g, int x, int y, int w, |
|
|
int h) |
|
|
{ |
|
|
Color saved = g.getColor(); |
|
|
AbstractButton b = (AbstractButton) c; |
|
|
if (b.getModel().isPressed()) |
|
|
{ |
|
|
g.setColor(darkShadow); |
|
|
g.drawRect(x, y, x + w - 1, y + h - 1); |
|
|
} |
|
|
else |
|
|
{ |
|
|
g.setColor(highlight); |
|
|
g.drawLine(x + 1, y + 1, x + w - 3, y + 1); |
|
|
g.drawLine(x + 1, y + 1, x + 1, y + h - 2); |
|
|
|
|
|
g.setColor(shadow); |
|
|
g.drawLine(x + 1, y + h - 2, x + w - 1, y + h - 2); |
|
|
g.drawLine(x + w - 2, y + 1, x + w - 2, y + h - 2); |
|
|
|
|
|
g.setColor(darkShadow); |
|
|
g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); |
|
|
g.drawLine(x + w - 1, y, x + w - 1, y + h - 1); |
|
|
|
|
|
g.setColor(saved); |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
101 |
/** |
/** |
102 |
* Creates a new BasicArrowButton object. |
* Creates a new BasicArrowButton object. |
103 |
* |
* |
106 |
public BasicArrowButton(int direction) |
public BasicArrowButton(int direction) |
107 |
{ |
{ |
108 |
super(); |
super(); |
|
setBorder(buttonBorder); |
|
109 |
setDirection(direction); |
setDirection(direction); |
110 |
} |
} |
111 |
|
|