Monday, 15 July 2013

jlabel - Java Slider and ProgressBar -



jlabel - Java Slider and ProgressBar -

i have 2 minor problems progressbar have connected slider in java frame working on. using netbeans. have added code :

private void jslider1statechanged(javax.swing.event.changeevent evt) { jslider source = (jslider)evt.getsource() ; int value = source.getvalue() ; jprogressbar1.setvalue(value) ;}

as move slider, progressbar moves motion of slider. however, doesn't show value in slider. think code above setting this, moves , no value printed in progressbar. missing please?

this should stupid simple question. labels have got under slider, shown when set min/max 0 - 5. when set min/max 1 - 5, label 1 shown 5 not shown. should see labels 1 - 5 under slider?

for first problem, should set progressbar.setstringpainted(true); on progressbar, show specific values in progressbar add together next line:

jprogressbar1.setvalue(value); jprogressbar1.setstring(string.valueof(value)); // 1

for more info check documentation of jprogressbar.

java jlabel jprogressbar jslider

No comments:

Post a Comment