java - How to change default/start value of JSlider -
i wondering how can alter start value of jslider using.
my code looks this:
public scalecontroller() { // slider 1: // -------------------------------------------------------------------- setorientation(swingconstants.vertical); addchangelistener(this); setmajortickspacing(10); setpaintticks(true); setmaximum(50); setminimum(-50); hashtable<integer, jlabel> labeltable = new hashtable<integer, jlabel>(); labeltable.put(new integer(50), new jlabel("zoom +5")); labeltable.put(new integer(0), new jlabel("zoom 0")); labeltable.put(new integer(-50), new jlabel("zoom -5")); setlabeltable(labeltable); setpaintlabels(true); @override public void statechanged(changeevent e) { controller.setzoom(getvalue()); }
i want default value 0, starts in middle of slider, can't figure out how this.
setvalue(0)
work in case check api here
java swing jslider
No comments:
Post a Comment