aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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: 10451
    
    8



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: 10451
    
    8

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: 10451
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: change progressBar look and feel