File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Murach's Java Servlets and JSP this week in the Servlets 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: 10167
    
    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: 10167
    
    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: 10167
    
    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.
 
jQuery in Action, 2nd edition
 
subject: change progressBar look and feel
 
Similar Threads
How to change color of SplitPane?
Disable Java Plug-in Progress Bar
Jasper Reports using AJAX
To change colour of Progress bar
Changing the progress color based on value