public void paintBorder(Component c,
Graphics g,
int x,
int y,
int w,
int h) {
Color background;
Color highlight;
Color shadow;
Window window = SwingUtilities.getWindowAncestor(c);
if (window != null && window.isActive()) {
background = getActiveBackground();
highlight = getActiveHighlight();
shadow = getActiveShadow();
} else {
background = getInactiveBackground();
highlight = getInactiveHighlight();
shadow = getInactiveShadow();
}
g.setColor(background);
// Draw outermost lines
g.drawLine( x + 1, y + 0, x + w-2, y + 0);
g.drawLine( x + 0, y + 1, x + 0, y + h - 2);
g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2);
g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1);
// Draw the bulk of the border
for (int i = 1; i < 5; i++) {
g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1);
}
if ((window instanceof Dialog) && ((Dialog) window).isResizable()) {
g.setColor(highlight);
// Draw the Long highlight lines
g.drawLine( corner+1, 3, w-corner, 3);
g.drawLine( 3, corner+1, 3, h-corner);
g.drawLine( w-2, corner+1, w-2, h-corner);
g.drawLine( corner+1, h-2, w-corner, h-2);
g.setColor(shadow);
// Draw the Long shadow lines
g.drawLine( corner, 2, w-corner-1, 2);
g.drawLine( 2, corner, 2, h-corner-1);
g.drawLine( w-3, corner, w-3, h-corner-1);
g.drawLine( corner, h-3, w-corner-1, h-3);
}
}
|