wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes change progressBar look and feel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "change progressBar look and feel" Watch "change progressBar look and feel" New topic
Author

change progressBar look and feel

swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129
Hi,

I have shown a progress bar in my application.
when value of progress bar increases it get filled with color.
I want to change that color of my choice.
how I can do that ??

thanks
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9



Make these the first lines in your main method. Essentially this should be defined before you create any progress bar objects.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129
but we are not mentioning any object reference to progressBar instance.
How UIManager going to understand which object it should refer ?
swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129
the solution you've given is working
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Check out the source code for the BasicProgressBarUI and see where and how it uses these properties.
The source code can be found in a file called src.zip in your java installation directory
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

swapnel surade wrote:the solution you've given is working


Is it?
Now add UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); before you create the UI and see what happens
swapnel surade
Ranch Hand

Joined: Mar 05, 2009
Posts: 129



this snippet applies the system level UI changes to application.

is there any way to change the shape of the progress bar box.

santhosh varala kumar
Greenhorn

Joined: Nov 05, 2009
Posts: 25
In that case you need to overrite your own basic progressbar ui so that while painting it will under go and draw how we have specified.
 
Don't get me started about those stupid light bulbs.
 
subject: change progressBar look and feel