Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static void main(String[] argv) throws Exception {
        JSpinner spinner = new JSpinner();
        spinner.addChangeListener(new SpinnerListener());

        spinner.setValue(new Integer(100));
    }
}

class SpinnerListener implements ChangeListener {
    public void stateChanged(ChangeEvent evt) {
        JSpinner spinner = (JSpinner) evt.getSource();

        // Get the new value
        Object value = spinner.getValue();
    }
}