Is it possible to start JProgressBar from inbetween.I know this is wierd but I need to show the update between 20-80% and the progress bar should be invisible between 0-20% and 80-100% and the number 20 and 80 are run time variables.
+2
A:
The value displayed is dictated by the underlying data model (BoundedRangeModel
). You could subclass the DefaultBoundedRangeModel
(or create on from scratch by implementing BoundedRangeModel
) so that the getExtent()
always returns between 20-80%.
The new model can be supplied to JProgressBar
via its constructor or setModel
method.
Kris
2010-08-27 09:59:14
I tried to access getModel and set the values as 20 and 80 but it creates new problem.Actually it reduces its range to 20-80 and there by to denote 45% complettion it will denote it as 42% which is numerical.What I need is GUI based.To be more specific I am embedding this progress bar inside a JTable cell and paint it in between(20%-80%) the table cell will have any value between 20-80 and I need to paint till that part starting from 20.I am not sure whether its clear but I can explain if you need.
Harish
2010-08-27 10:26:02
@Harish, I've edited my answer. It is a more complicated solution but will give you fine grained control over what the JProgressBar is displaying.
Kris
2010-08-27 10:56:52