2013-10-03 41 views

回答

4

setLabelTable方法。從the tutorial複製粘貼:

//Create the slider 
JSlider framesPerSecond = new JSlider(JSlider.VERTICAL, 
             FPS_MIN, FPS_MAX, FPS_INIT); 
... 

//Create the label table 
Hashtable labelTable = new Hashtable(); 
labelTable.put(new Integer(0), new JLabel("Stop")); 
labelTable.put(new Integer(FPS_MAX/10), new JLabel("Slow")); 
labelTable.put(new Integer(FPS_MAX), new JLabel("Fast")); 
framesPerSecond.setLabelTable(labelTable); 

framesPerSecond.setPaintLabels(true); 
+0

+1爲教程鏈接。 – camickr