Java SpinnerNumberModel create from default constructor

Description

Java SpinnerNumberModel create from default constructor

import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerModel;
import javax.swing.SpinnerNumberModel;

public class Main extends JFrame {
   public Main() {
      super("java2s.com");

      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setLayout(new FlowLayout());

      SpinnerModel model = new SpinnerNumberModel();
      JSpinner spinner = new JSpinner(model);
      /*  w  w w . j a v a2 s.c  o m*/
      getContentPane().add(spinner);
   }

   public static void main(String[] args) {
      Main frame = new Main();
      frame.pack();
      frame.setVisible(true);
   }
}



PreviousNext

Related