I just wanted to use the Windows L&F in a
JFrame
. Now while using a progress bar, the default color is green, similar to the one used in other windows functions like copying of files, etc. Sometimes you might have seen, windows displays a 'RED' - colored progress (when there may be an overwrite in case of copying of files). How can I use that 'RED' color in case of my progress bar, instead of setting the 'foreground color' to 'RED', which looks different?
Asked
Active
Viewed 583 times
2

se7en
- 87
- 1
- 3
- 16
-
Can you show us a screenshot of the normal progress bar as well as the red version? – Andrew Thompson Apr 17 '13 at 11:08
-
1simple, clear, easy, everything depends of theme, Win theme and Win Color theme, then same for Font, mouse, alingment ...., there is simple, clear, easy, solution to put a proper value or Color to UIManager – mKorbel Apr 17 '13 at 11:12
-
I have two screen shots. How do I upload them here? @AndrewThompson – se7en Apr 17 '13 at 11:18
-
If you have enough rep., click the little button above the message posting/editing form just to the right of the `{}` button. If you don't, upload them to an image share site and link. – Andrew Thompson Apr 17 '13 at 11:19
-
Just check the image, the first look is of my concern. – se7en Apr 17 '13 at 11:25
-
@Anirban Das aaaach, here are a few Q&A about that, without any issue for most Look and Feels excluding Nimbus Look and Feel – mKorbel Apr 17 '13 at 11:38
-
@mKorbel, Sorry, I dint get you! – se7en Apr 17 '13 at 11:43
-
1@Anirban Das [for example](http://stackoverflow.com/a/12525351/714968), don't forget to upvote correct answer from this thread – mKorbel Apr 17 '13 at 11:55
1 Answers
3
Java implements the native looking progress bar using their own code. It doesn't support the Vista and newer features that indicate stalled/slow progress by changing the color of the bar.
The source that draws the bar is available to examine; it uses the paintSkin
method to paint the bar, which by default, only paints in one color.
The design guidelines for progress bar use on Windows indicate that you should:
- Use red or yellow progress bars only to indicate the progress status, not the final results of a task. A red or yellow progress bar indicates that users need to take some action to complete the task. If the condition isn't recoverable, leave the progress bar green and display an error message.
- Turn the progress bar red when there is a user recoverable condition that prevents making further progress. Display a message to explain the problem and recommend a solution. Turn the progress bar yellow to indicate either that the user has paused the task or that there is a condition that is impeding progress but progress is still taking place (as, for example, with poor network connectivity). If the user has paused, change the Pause button label to Resume. If progress is impeded, display a message to explain the problem and recommend a solution.

Anya Shenanigans
- 91,618
- 3
- 107
- 122
-
1Override the painting method? It's quite intertwined with other windows look and feel elements so I don't think it's trivial – Anya Shenanigans Apr 17 '13 at 11:28
-
1the java implementation of most native components is a skin-level implementation, and doesn't expose most of the features. If you want to accomplish a more native-like experience you *might* be better switching to SWT. Most of my java experience is on the server-side so there may be someone better able to advise in this case. – Anya Shenanigans Apr 17 '13 at 11:31
-
Ok, I really appreciate your help, that knowledge would surely help, but right now I am just concerned about the color, that's all, So, If there is no choice I'll go for setting the foreground color and stop the string display. – se7en Apr 17 '13 at 11:32