0

I have a couple of questions which I can't find the answer to.

I've created a JProgressBar and set a custom font:

JProgressbar progressBar = new JProgressBar();
progressBar.setFont(new Font(null, Font.ITALIC, 9));

On every OS, this results in the text being displayed at the top of the progress bar, instead of being vertically centered. Is there any way to specify that the String of a JProgressBar should be vertically aligned? I've looked online and haven't found a single thing.

Also, I've noticed that for a JProgressBar, if you set the look and feel to the system defaults and you don't setStringPainted(true), then on Windows systems, the progressBar will look like the system default which is good. However, if you setStringPainted(true), then the progressBar turns from the Windows animated green, to a basic blue color. Does anyone know how to correct this?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Cristian
  • 6,765
  • 7
  • 43
  • 64
  • 1
    `Font(null, Font.ITALIC, 9)` Wait a second `null`? I am surprised that does not throw a run-time exception. For better help sooner, post an [SSCCE](http://sscce.org/). Use one of the stock standard fonts in the JRE. – Andrew Thompson Dec 10 '12 at 11:17
  • @AndrewThompson If you use null, then it uses the default font. I'll make a SSCCE. – Cristian Dec 10 '12 at 11:28

0 Answers0