Mega Code Archive

 
Categories / Java / Swing JFC
 

Set all the values at once by using the model

import javax.swing.JSlider; public class Main {   public static void main(String[] argv) throws Exception {     JSlider slider = new JSlider();     int newValue = 2;     int newExtent = 10;     int newMin = 0;     int newMax = 10;     slider.getModel().setRangeProperties(newValue, newExtent, newMin, newMax,         false);   } }