Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JSpinner;
import javax.swing.SpinnerListModel;

public class Main extends JFrame {
    public Main() {
        JSpinner m_listSpinner;
        SpinnerListModel m_listSpinnerModel;
        List<String> sequence = new ArrayList<String>();

        sequence.add(new String("I - First"));
        sequence.add(new String("II - Second"));
        sequence.add(new String("III - Third"));
        sequence.add(new String("IV - Fourth"));
        sequence.add(new String("V - Fifth"));
        sequence.add(new String("VI - Sixth"));

        m_listSpinnerModel = new SpinnerListModel(sequence);

        m_listSpinner = new JSpinner(m_listSpinnerModel);
        add(m_listSpinner);
    }

    public static void main(String argv[]) {
        Main spinnerFrame = new Main();
        spinnerFrame.setSize(350, 200);
        spinnerFrame.setVisible(true);
    }
}