1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
public void paint(Graphics g) {
try {
setOpaque(false);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(new GradientPaint(20, 0, getBackground(),getWidth()-40, getHeight(), gradienColor, true));
g2d.fillRect(20, 0, getWidth()-40, getHeight());
Dimension d = getSize();
g.setColor(Color.black);
g.drawRect(20, 0, d.width - 41, d.height - 1);
super.paint(g);
g.drawImage(image, d.width - 40, 2, null);
} catch (IllegalArgumentException e) {
// JDK Bug: Zero length string passed to TextLayout constructor
}
} |
Partager