Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class Main {
    public static void main(String[] argv) throws Exception {
        JSlider slider = new JSlider();
        slider.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent evt) {
                JSlider slider = (JSlider) evt.getSource();
                if (!slider.getValueIsAdjusting()) {
                    int value = slider.getValue();
                    System.out.println(value);
                }
            }
        });
    }
}