Java JSlider create
import javax.swing.JFrame; import javax.swing.JSlider; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Main { public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL, 10, 100, 20); framesPerSecond.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int fps = (int) source.getValue(); System.out.println(fps); }/* w ww . ja v a 2 s .com*/ } }); frame.add(framesPerSecond,"North"); frame.setSize(300, 200); frame.setVisible(true); } }