public void paint(Graphics g, JComponent c) {
JProgressBar prog = (JProgressBar) c;
Graphics2D gfx = (Graphics2D) g;
Dimension size = c.getSize();
if (true) {
gfx.setColor(c.getBackground());
} else if (prog.getOrientation() == JProgressBar.HORIZONTAL) {
gfx.setPaint(
new GradientPaint(
0, 0, UIManager.getColor("ProgressBar.gradientStart"), 0, size.height / 2,
UIManager.getColor("ProgressBar.gradientEnd"), true));
} else {
gfx.setPaint(
new GradientPaint(
0, 0, UIManager.getColor("ProgressBar.gradientStart"), size.width / 2, 0,
UIManager.getColor("ProgressBar.gradientEnd"), true));
}
gfx.fill(new Rectangle(0, 0, size.width, size.height));
super.paint(g, c);
}