1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public static class MyPainter implements Painter {
@Override
public void paint(Graphics2D g, Object object, int width, int height) {
if (object instanceof javax.swing.JProgressBar){
Color blueColor = new Color(84, 118, 255);
Color blueColorWithAlpha = new Color(84, 118, 255, 127);
GradientPaint GRADIENT_1 = new GradientPaint(0, 0, blueColorWithAlpha, 0, height/2, blueColor);
g.setPaint(GRADIENT_1);
g.fillRect(0, 0, width, height/2);
GradientPaint GRADIENT_2 = new GradientPaint(0, height/2, blueColor, 0, height, blueColorWithAlpha);
g.setPaint(GRADIENT_2);
g.fillRect(0, height/2, width, height);
}
}
} |
Partager