Mega Code Archive

 
Categories / Java Tutorial / Swing
 

Set to a spot between tick marks; the value moves to closest tick mark

import javax.swing.JSlider; public class Main {   public static void main(String[] argv) throws Exception {     JSlider slider = new JSlider();     slider.setValue(27);     int value = slider.getValue();   } }