I have been testing out the component JProgressBar, now from what i learned so far
it's easy to handle but any way i try it i cannot get it to work.

To explain: I want to have a JProgressBar component that will show the total and consumed amount of oil. | 5000 / 12943 |

I am writing a simulator for oil distribution over a pre defined pipeline and this pipeline can handle 1000 total liters in flow. Now to the pipe line i can add choke points that control how much of oil can flow. Now if i add 1 button to the pipeline that would be 126 / 1000 and i want my jprogressbar to show that instead of a % amount. And if i add another choke point it goes up 252 / 1000 etc until 1000.


I am getting really sleepy so i may just be overlooking something in JProgressBar or it truly cant be implement whit that component in that case can anyone suggest a decent alternative to SWING that can implement this.

You can define or redefine the min and max values for the bar whenever you want. You can replace the % display when you update the value by calling setString, eg
progressBar.setString(value + "/" + max);
so I don't understand exactly what you want to do that is a problem.

ps You could also subclass JProgressBar and override getString() to return getValue()+"/"+getMax(). That would be really neat.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.