Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / February 2004

Tip: Looking for answers? Try searching our database.

Multiple Colors in same ProgressBar

Thread view: 
amit phalgune - 03 Feb 2004 07:10 GMT
Hi
My request might sound wierd, but I want to display multiple colors in
the same JprogressBar ( or rather a ProgressBar)
For example : There is a Progressbar which shows 50 % complete with
blue color and on the same progressbar, I want to show 20 % complete (
some other activity which is 20 % complete) by a yellow color.
So at the same time, I need to see the 50 % blue and the 20 % yellow,
with the first 20 % of the blue bar overwritten with the 20 % yellow
bar..

How can I do this? Is there any way I can do this using the
JProgressBar object in java, instead of I having to write the whole
code myself ( again). Is any one will to share their code, which they
gave previously written..
Thanks
A
Andrew Thompson - 03 Feb 2004 07:34 GMT
"amit phalgune" ...
...
> My request might sound wierd, but I want to display multiple colors in
> the same JprogressBar ( or rather a ProgressBar)

What do your users want?  Do they want
progress bars with 'funky' colors?  Or
do they perhaps want progress bars that
are easily _recognisable_ as progress bars?

--
Andrew Thompson
* http://www.PhySci.org/ Open-source software suite
* http://www.PhySci.org/codes/ Web & IT Help
* http://www.1point1C.org/ Science & Technology
Igor Buzatovic - 03 Feb 2004 09:48 GMT
> Hi
> My request might sound wierd, but I want to display multiple colors in
[quoted text clipped - 10 lines]
> code myself ( again). Is any one will to share their code, which they
> gave previously written..

For such request as yours there is no easy way such as setting few
parameters and solve the problem. If you want "funky" progres bar you have
to extend JProgresBar and overwrite paintComponent method.

> Thanks
> A
amit phalgune - 04 Feb 2004 18:42 GMT
How do I use the paintComponent.
To display the progress on the progessbar is just have the following
code:
JprogressBar pbar = new JprogressBar();

pbar.setValue(50);       // Shows 50 % progress on the bar
pbar.setForeground(Color.red) // shows the above 50 % in red color

now if I do
pbar.setValue(20);
pbar.setForeGround(Color.green);

The progressbar displays 20 % of green color and the original 50 % is
lost.
But I want to show both the colors in the same bar. How do I do it ?
Where and how does the paintComponent come into the picture. Can
anyone please expalin.
Thanks
Amit

> > Hi
> > My request might sound wierd, but I want to display multiple colors in
[quoted text clipped - 17 lines]
> > Thanks
> > A
Thomas Fritsch - 03 Feb 2004 11:02 GMT
>Hi
>My request might sound wierd,

Yes, indeed ...

> but I want to display multiple colors in
>the same JprogressBar ( or rather a ProgressBar)
[quoted text clipped - 4 lines]
>with the first 20 % of the blue bar overwritten with the 20 % yellow
>bar..

Instead I would recommend 2 *separate* progress bars: one in blue (for
the 50 %), another one in yellow (for the 20 %).

>...
>  

Last but not least:
Bear in mind that your user should be able to *understand* your GUI
without any additional explanation beside it.

Thomas

______________________________________________________
Thomas <dot> Fritsch <at> ops <dot> de
amit phalgune - 03 Feb 2004 20:15 GMT
hi Thanks for all the quick doubts..
I have an explaination system ( tool tips, when the mouse pointer is
hovered over the progressbar, it shows the explaination).
Let me try to explain,
The progressbar will indicate the testing of a spreadsheet
environment, so the different colors will correspond to the different
percentages of the cells which are tested.

Yes, my users basically want 2 or 3 different colors in the same
progressbar because these colors will indcate / map to the cells ( the
cells will have different  colors and there will be a co-relation
between the cell color and the colors in the progressbar.
So the question still remains.. How do we do it ?

Thanks
Amit

> >Hi
> >My request might sound wierd,
[quoted text clipped - 24 lines]
> ______________________________________________________
> Thomas <dot> Fritsch <at> ops <dot> de


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.