This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Changing the progress color based on value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Changing the progress color based on value" Watch "Changing the progress color based on value" New topic
Author

Changing the progress color based on value

Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 289

Hi all

i have a table where in one coloumn i have to fill the value example 50% and the cell background color should be green till the 50% of the Cell
i think you got what i want.

so i thought of putting the JProgress bar in the renderrer of the table cell, but problem is how to change the color of the progress
for example till
60% it should be green
61%-80% Orange
more then 81%- Red
like this.

This idea is correct?
if yes how to change the color of the progress bar. i have tried googling. but that logic will change the color of all the ProgressBar in the Application.

if this idea will not work, which i can try?

Thanks in advance

-Chiru
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Conditionally set the foreground in the getTableCellRendererComponent method. Don't forget to include all possible conditions to that the foreground is set to the desired color every time the method is invoked.

luck, db
There are no new questions, but there may be new answers.
Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 289

But according the forground we have to change the string color also.. can we do that?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Changing the progress color based on value
 
Similar Threads
To change colour of Progress bar
problem with displaytag and basicDynaBean
change progressBar look and feel
wants to display Cell color in a table based on source value
any ideas?