Example usage for javax.swing JSpinner JSpinner

List of usage examples for javax.swing JSpinner JSpinner

Introduction

In this page you can find the example usage for javax.swing JSpinner JSpinner.

Prototype

public JSpinner() 

Source Link

Document

Constructs a spinner with an Integer SpinnerNumberModel with initial value 0 and no minimum or maximum limits.

Usage

From source file:Main.java

public Main() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    JPanel buttonPanel = new JPanel();
    okButton = new JButton("Ok");
    buttonPanel.add(okButton);/*ww  w  .  j  ava  2 s.c o  m*/
    add(buttonPanel, BorderLayout.SOUTH);

    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 3));
    add(mainPanel, BorderLayout.CENTER);

    JSpinner defaultSpinner = new JSpinner();
    addRow("Default", defaultSpinner);

    JSpinner boundedSpinner = new JSpinner(new SpinnerNumberModel(5, 0, 10, 0.5));
    addRow("Bounded", boundedSpinner);

    String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

    JSpinner listSpinner = new JSpinner(new SpinnerListModel(fonts));
    addRow("List", listSpinner);

    JSpinner reverseListSpinner = new JSpinner(new SpinnerListModel(fonts) {
        public Object getNextValue() {
            return super.getPreviousValue();
        }

        public Object getPreviousValue() {
            return super.getNextValue();
        }
    });
    addRow("Reverse List", reverseListSpinner);

    JSpinner dateSpinner = new JSpinner(new SpinnerDateModel());
    addRow("Date", dateSpinner);

    JSpinner betterDateSpinner = new JSpinner(new SpinnerDateModel());
    String pattern = ((SimpleDateFormat) DateFormat.getDateInstance()).toPattern();
    betterDateSpinner.setEditor(new JSpinner.DateEditor(betterDateSpinner, pattern));
    addRow("Better Date", betterDateSpinner);

    JSpinner timeSpinner = new JSpinner(new SpinnerDateModel());
    pattern = ((SimpleDateFormat) DateFormat.getTimeInstance(DateFormat.SHORT)).toPattern();
    timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, pattern));
    addRow("Time", timeSpinner);

    JSpinner permSpinner = new JSpinner(new PermutationSpinnerModel("meat"));
    addRow("Word permutations", permSpinner);
}

From source file:SpinnerTest.java

public SpinnerFrame() {
    setTitle("SpinnerTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    JPanel buttonPanel = new JPanel();
    okButton = new JButton("Ok");
    buttonPanel.add(okButton);/*  w  w w .ja  va  2 s . c o  m*/
    add(buttonPanel, BorderLayout.SOUTH);

    mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 3));
    add(mainPanel, BorderLayout.CENTER);

    JSpinner defaultSpinner = new JSpinner();
    addRow("Default", defaultSpinner);

    JSpinner boundedSpinner = new JSpinner(new SpinnerNumberModel(5, 0, 10, 0.5));
    addRow("Bounded", boundedSpinner);

    String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

    JSpinner listSpinner = new JSpinner(new SpinnerListModel(fonts));
    addRow("List", listSpinner);

    JSpinner reverseListSpinner = new JSpinner(new SpinnerListModel(fonts) {
        public Object getNextValue() {
            return super.getPreviousValue();
        }

        public Object getPreviousValue() {
            return super.getNextValue();
        }
    });
    addRow("Reverse List", reverseListSpinner);

    JSpinner dateSpinner = new JSpinner(new SpinnerDateModel());
    addRow("Date", dateSpinner);

    JSpinner betterDateSpinner = new JSpinner(new SpinnerDateModel());
    String pattern = ((SimpleDateFormat) DateFormat.getDateInstance()).toPattern();
    betterDateSpinner.setEditor(new JSpinner.DateEditor(betterDateSpinner, pattern));
    addRow("Better Date", betterDateSpinner);

    JSpinner timeSpinner = new JSpinner(new SpinnerDateModel());
    pattern = ((SimpleDateFormat) DateFormat.getTimeInstance(DateFormat.SHORT)).toPattern();
    timeSpinner.setEditor(new JSpinner.DateEditor(timeSpinner, pattern));
    addRow("Time", timeSpinner);

    JSpinner permSpinner = new JSpinner(new PermutationSpinnerModel("meat"));
    addRow("Word permutations", permSpinner);
}

From source file:com.kbotpro.ui.FieldWatcher.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    label2 = new JLabel();
    updateRateSpinner = new JSpinner();
    label3 = new JLabel();
    scrollPane1 = new JScrollPane();
    infoLabel = new JLabel();

    //======== this ========
    setTitle("Field Watch");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();

    //---- label2 ----
    label2.setText("Update rate:");
    label2.setLabelFor(updateRateSpinner);

    //---- updateRateSpinner ----
    updateRateSpinner.setModel(new SpinnerNumberModel(1.0, 0.1, null, 0.5));

    //---- label3 ----
    label3.setText("Times per second");

    //======== scrollPane1 ========
    {//w w w  .j a v a2s  .c o  m

        //---- infoLabel ----
        infoLabel.setText("Field info");
        infoLabel.setVerticalAlignment(SwingConstants.TOP);
        scrollPane1.setViewportView(infoLabel);
    }

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPane.setLayout(contentPaneLayout);
    contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup()
            .add(contentPaneLayout.createSequentialGroup().addContainerGap().add(contentPaneLayout
                    .createParallelGroup().add(scrollPane1, GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE)
                    .add(contentPaneLayout.createSequentialGroup().add(label2)
                            .addPreferredGap(LayoutStyle.RELATED)
                            .add(updateRateSpinner, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(LayoutStyle.RELATED).add(label3)))
                    .addContainerGap()));
    contentPaneLayout
            .setVerticalGroup(contentPaneLayout.createParallelGroup().add(GroupLayout.TRAILING,
                    contentPaneLayout.createSequentialGroup().addContainerGap()
                            .add(scrollPane1, GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
                            .addPreferredGap(LayoutStyle.RELATED)
                            .add(contentPaneLayout.createParallelGroup(GroupLayout.BASELINE).add(label2)
                                    .add(updateRateSpinner, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .add(label3))
                            .addContainerGap()));
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.anrisoftware.prefdialog.fields.spinner.SpinnerField.java

/**
 * @see SpinnerFieldFactory#create(Object, String)
 *///from   w ww  .  j a  va  2s.  c o m
@Inject
SpinnerField(SpinnerFieldLogger logger, @Assisted Object parentObject, @Assisted String fieldName) {
    super(new JSpinner(), parentObject, fieldName);
    this.log = logger;
    this.customModelSet = false;
    this.changeListener = new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            try {
                setValue(getComponent().getValue());
            } catch (PropertyVetoException e1) {
            }
        }
    };

}

From source file:edu.ku.brc.specify.toycode.UpdatesApp.java

protected void createUI() {
    baseBBP = new BrowseBtnPanel(baseTF, false, true);
    baseUpBBP = new BrowseBtnPanel(baseUpTF, false, true);
    macFullBBP = new BrowseBtnPanel(macFullTF, false, true);
    macUpBBP = new BrowseBtnPanel(macUpTF, false, true);
    outBBP = new BrowseBtnPanel(outTF, false, true);

    verSub1 = new JSpinner();
    verSub2 = new JSpinner();

    PanelBuilder pb = new PanelBuilder(
            new FormLayout("p,2px,p,f:p:g,p", createDuplicateJGoodiesDef("p:g", "4px", 7)));
    CellConstraints cc = new CellConstraints();

    int y = 1;/*from  ww w .  j a  va  2 s  .  c  o m*/
    pb.add(createLabel("Linux/Win Full:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(baseBBP, cc.xyw(3, y, 3));
    y += 2;

    pb.add(createLabel("Linux/Win Update:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(baseUpBBP, cc.xyw(3, y, 3));
    y += 2;

    pb.add(createLabel("Mac Full:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(macFullBBP, cc.xyw(3, y, 3));
    y += 2;

    pb.add(createLabel("Mac Update:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(macUpBBP, cc.xyw(3, y, 3));
    y += 2;

    pb.add(createLabel("Output:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(outBBP, cc.xyw(3, y, 3));
    y += 2;

    updateBaseTF.setText("6.0.0");
    pb.add(createLabel("Update Base Version:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(updateBaseTF, cc.xy(3, y));
    y += 2;

    versionTF.setText("6");
    verSub1.setValue(99);
    verSub2.setValue(99);

    PanelBuilder vpb = new PanelBuilder(new FormLayout("p,p,p:g,p,p:g,f:p:g", "p"));
    vpb.add(versionTF, cc.xy(1, 1));
    vpb.add(createLabel("."), cc.xy(2, 1));
    vpb.add(verSub1, cc.xy(3, 1));
    vpb.add(createLabel("."), cc.xy(4, 1));
    vpb.add(verSub2, cc.xy(5, 1));

    pb.add(createLabel("New Version:", SwingConstants.RIGHT), cc.xy(1, y));
    pb.add(vpb.getPanel(), cc.xyw(3, y, 1));
    y += 2;

    PanelBuilder pb2 = new PanelBuilder(new FormLayout("p,2px,p,f:p:g,p", "p"));
    statusTF.setBackground(getBackground());
    pb2.add(statusTF, cc.xyw(1, 1, 4));
    pb2.add(mergeBtn, cc.xy(5, 1));

    pb.getPanel().setBorder(BorderFactory.createEmptyBorder(14, 14, 1, 14));

    setLayout(new BorderLayout());

    add(pb.getPanel(), BorderLayout.CENTER);
    add(pb2.getPanel(), BorderLayout.SOUTH);

    try {
        XStream xstream = new XStream();
        props = (Properties) xstream.fromXML(FileUtils.readFileToString(new File("props.init")));

    } catch (Exception ex) {
        props = new Properties();
    }

    baseTF.setText(props.getProperty("baseTF", "MacMedia/updates.xml.winlinfull.6.1.17"));
    baseUpTF.setText(props.getProperty("baseUpTF", "MacMedia/updates.xml.winlinupdate.6.1.17"));
    macFullTF.setText(props.getProperty("macFullTF", "MacMedia/updates_mac.xml"));
    macUpTF.setText(props.getProperty("macUpTF", "MacMedia/updates_mac_update.xml"));
    outTF.setText(props.getProperty("outTF", "MacMedia/updates.xml"));
    updateBaseTF.setText(props.getProperty("updateBaseTF", "6.0.0"));
    versionTF.setText(props.getProperty("versionTF", "6"));

    verSub1.setValue(Integer.parseInt(props.getProperty("subVer1", "1")));
    verSub2.setValue(Integer.parseInt(props.getProperty("subVer2", "11")));

    mergeBtn.addActionListener(new ActionListener() {

        /* (non-Javadoc)
         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            merge(baseTF.getText(), baseUpTF.getText(), macFullTF.getText(), macUpTF.getText(), outTF.getText(),
                    updateBaseTF.getText(), versionTF.getText(), Integer.toString((Integer) verSub1.getValue()),
                    Integer.toString((Integer) verSub2.getValue()));

            doSave(outTF.getText());
        }

    });

}

From source file:geneticalgorithm.gui.view.VExperiment.java

public VExperiment() {
    setLayout(new BorderLayout());
    setSize(900, 700);/* w  ww . jav  a 2 s .  c o m*/
    setLocationRelativeTo(this);
    setResizable(false);
    buttons = new ArrayList<JButton>();

    // CENTER

    pnlCentral = new JPanel();
    pnlCentral.setLayout(new MigLayout());
    add(pnlCentral, BorderLayout.CENTER);

    lblLocale = new JLabel();
    cmbModelSelectLocale = new DefaultComboBoxModel<String>();
    cmbSelectLocale = new JComboBox<String>(cmbModelSelectLocale);

    lblLimLow = new JLabel();
    spiLow = new JSpinner();
    spiLow.setModel(new SpinnerNumberModel(-10., -100000., 100000., .5));

    lblLimUp = new JLabel();
    spiUp = new JSpinner();
    spiUp.setModel(new SpinnerNumberModel(10., -100000., 100000., .5));

    lblChromosome = new JLabel();
    spiChromosome = new JSpinner();
    spiChromosome.setModel(new SpinnerNumberModel(10, 0, 63, 1));

    lblPopulation = new JLabel();
    spiPopulation = new JSpinner();
    spiPopulation.setModel(new SpinnerNumberModel(10, 0, 100000, 1));

    lblGenerations = new JLabel();
    spiGenerations = new JSpinner();
    spiGenerations.setModel(new SpinnerNumberModel(100, 0, 100000, 1));

    lblProbCrossover = new JLabel();
    txtProbCrossover = new JTextField("0.5");

    lblProbMutation = new JLabel();
    txtProbMutation = new JTextField("0.001");

    lblIndividual = new JLabel();
    cmbModelIndividual = new DefaultComboBoxModel<ClassWrapper>();
    cmbIndividual = new JComboBox<ClassWrapper>(cmbModelIndividual);

    lblCrossover = new JLabel();
    cmbModelCrossover = new DefaultComboBoxModel<ClassWrapper>();
    cmbCrossover = new JComboBox<ClassWrapper>(cmbModelCrossover);

    lblMutation = new JLabel();
    cmbModelMutation = new DefaultComboBoxModel<ClassWrapper>();
    cmbMutation = new JComboBox<ClassWrapper>(cmbModelMutation);

    lblSelection = new JLabel();
    cmbModelSelection = new DefaultComboBoxModel<ClassWrapper>();
    cmbSelection = new JComboBox<ClassWrapper>(cmbModelSelection);

    lblFitness = new JLabel();
    cmbModelFitness = new DefaultComboBoxModel<ClassWrapper>();
    cmbFitness = new JComboBox<ClassWrapper>(cmbModelFitness);

    lblPathOutput = new JLabel();
    txtPathOutput = new JTextField();
    btnPathOutput = new JButton("...");

    lblName = new JLabel();
    txtName = new JTextField();

    lblAverage = new JLabel("");
    lblAverage.setHorizontalTextPosition(SwingConstants.LEFT);
    lblAverageTitle = new JLabel("Average: ");

    lblOffline = new JLabel("");
    lblOffline.setHorizontalTextPosition(SwingConstants.LEFT);
    lblOfflineTitle = new JLabel("Offline: ");

    lblOnline = new JLabel("");
    lblOnline.setHorizontalTextPosition(SwingConstants.LEFT);
    lblOnlineTitle = new JLabel("Online: ");

    lblElite = new JLabel("");
    lblElite.setHorizontalTextPosition(SwingConstants.LEFT);
    lblEliteTitle = new JLabel("Elite: ");

    average = new XYSeries("Average");
    offline = new XYSeries("Offline");
    online = new XYSeries("Online");
    elite = new XYSeries("Elite");

    dataset = new XYSeriesCollection();
    dataset.addSeries(average);
    dataset.addSeries(online);
    dataset.addSeries(elite);
    dataset.addSeries(offline);

    chart = ChartFactory.createXYLineChart("title", "xLabel", "yLabel", dataset, PlotOrientation.VERTICAL, true,
            true, false);
    chartPanel = new ChartPanel(chart);

    pnlCentral.add(lblLocale, "width 120, height 25");
    pnlCentral.add(cmbSelectLocale, "width 120, height 25, wrap");

    pnlCentral.add(lblLimLow, "width 120, height 25");
    pnlCentral.add(spiLow, "width 120, height 25");
    pnlCentral.add(lblIndividual, "width 80, height 25");
    pnlCentral.add(cmbIndividual, "growx, height 25, span 2, wrap");

    pnlCentral.add(lblLimUp, "width 120, height 25");
    pnlCentral.add(spiUp, "width 120, height 25");
    pnlCentral.add(lblCrossover, "width 80, height 25");
    pnlCentral.add(cmbCrossover, "growx, height 25, span 2, wrap");

    pnlCentral.add(lblChromosome, "width 120, height 25");
    pnlCentral.add(spiChromosome, "width 120, height 25");
    pnlCentral.add(lblMutation, "width 80, height 25");
    pnlCentral.add(cmbMutation, "growx, height 25, span 2, wrap");

    pnlCentral.add(lblPopulation, "width 120, height 25");
    pnlCentral.add(spiPopulation, "width 120, height 25");
    pnlCentral.add(lblSelection, "width 80, height 25");
    pnlCentral.add(cmbSelection, "growx, height 25, span 2");
    pnlCentral.add(lblAverageTitle, "width 70, height 25");
    pnlCentral.add(lblAverage, "width 200, height 25, wrap");

    pnlCentral.add(lblGenerations, "width 120, height 25");
    pnlCentral.add(spiGenerations, "width 120, height 25");
    pnlCentral.add(lblFitness, "width 80, height 25");
    pnlCentral.add(cmbFitness, "growx, height 25, span 2");
    pnlCentral.add(lblOnlineTitle, "growx, height 25");
    pnlCentral.add(lblOnline, "growx, height 25, wrap");

    pnlCentral.add(lblProbCrossover, "width 120, height 25");
    pnlCentral.add(txtProbCrossover, "width 120, height 25");
    pnlCentral.add(lblPathOutput, "width 80, height 25");
    pnlCentral.add(txtPathOutput, "width 280, height 25");
    pnlCentral.add(btnPathOutput, "width 20, height 25");
    pnlCentral.add(lblEliteTitle, "growx, height 25");
    pnlCentral.add(lblElite, "growx, height 25, wrap");

    pnlCentral.add(lblProbMutation, "width 120, height 25");
    pnlCentral.add(txtProbMutation, "width 120, height 25");
    pnlCentral.add(lblName, "width 80, height 25");
    pnlCentral.add(txtName, "growx, height 25, span 2");
    pnlCentral.add(lblOfflineTitle, "growx, height 25");
    pnlCentral.add(lblOffline, "growx, height 25, wrap");

    pnlCentral.add(chartPanel, "growx, span 7");

    // SOUTH
    pnlSouth = new JPanel();
    add(pnlSouth, BorderLayout.SOUTH);

    btnRun = new JButton();
    btnStop = new JButton();
    btnClose = new JButton();

    pnlSouth.add(btnRun);
    pnlSouth.add(btnStop);
    pnlSouth.add(btnClose);

    // ADD BUTTONS
    buttons.add(btnClose);
    buttons.add(btnStop);
    buttons.add(btnPathOutput);
    buttons.add(btnRun);
}

From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java

private JSpinner getSampleSpinner() {
    if (sampleSpinner == null) {
        sampleSpinner = new JSpinner();
        SpinnerNumberModel numberModel = new SpinnerNumberModel(TypeAEvaluationOptions.getSampleRate(), 1.0,
                10.0, 1.0);/*from  www .j  av a  2 s. co m*/
        sampleSpinner.setModel(numberModel);

        sampleSpinner.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                SpinnerNumberModel model = (SpinnerNumberModel) sampleSpinner.getModel();
                double selectedValue = model.getNumber().doubleValue();
                sampleRate = selectedValue;

            }
        });
    }
    return sampleSpinner;
}

From source file:ch.fork.AdHocRailway.ui.locomotives.configuration.LocomotiveConfig.java

private void initComponents() {

    nameTextField = BasicComponentFactory
            .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_NAME));
    nameTextField.setColumns(30);/*from   w  ww  .  ja  v a2s.c o  m*/

    descTextField = BasicComponentFactory
            .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_DESCRIPTION));
    descTextField.setColumns(30);

    imageChoserPanel = new JPanel(new MigLayout("fill"));

    imageTextField = BasicComponentFactory
            .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_IMAGE));
    imageTextField.setColumns(30);

    chooseImageButton = new JButton("Choose...");
    chooseImageButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            chooseLocoImage();
        }
    });

    imageChoserPanel.add(imageTextField, "grow");
    imageChoserPanel.add(chooseImageButton);

    imageLabel = new JLabel();
    imageLabel.setHorizontalAlignment(SwingConstants.CENTER);

    imageLabel.setIcon(LocomotiveImageHelper.getLocomotiveIcon(presentationModel.getBean()));

    busSpinner = new JSpinner();
    busSpinner.setModel(SpinnerAdapterFactory.createNumberAdapter(
            presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_BUS), 1, // defaultValue
            0, // minValue
            100, // maxValue
            1)); // step

    address1Spinner = new JSpinner();
    address1Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter(
            presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS1), 1, // defaultValue
            0, // minValue
            324, // maxValue
            1)); // step

    address2Spinner = new JSpinner();
    address2Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter(
            presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS2), 1, // defaultValue
            0, // minValue
            324, // maxValue
            1)); // step

    final List<LocomotiveType> locomotiveTypes = Arrays.asList(LocomotiveType.values());

    final ValueModel locomotiveTypeModel = presentationModel
            .getBufferedModel(Locomotive.PROPERTYNAME_LOCOMOTIVE_TYPE);
    locomotiveTypeComboBox = BasicComponentFactory
            .createComboBox(new SelectionInList<LocomotiveType>(locomotiveTypes, locomotiveTypeModel));

    functions = new ArrayListModel<LocomotiveFunction>(presentationModel.getBean().getFunctions());
    functionsTable = new JTable();
    functionsModel = new SelectionInList<LocomotiveFunction>();
    functionsModel.setList(functions);

    functionsTable.setModel(new LocomotiveFunctionTableModel(functionsModel));
    functionsTable.getColumnModel().getColumn(0).setCellRenderer(new CenterRenderer());

    errorPanel = new ErrorPanel();

    validate(presentationModel.getBean(), null);
    presentationModel.getBean().addPropertyChangeListener(this);
    okButton = new JButton(new ApplyChangesAction());
    cancelButton = new JButton(new CancelAction());
}

From source file:au.org.ala.delta.editor.ui.ItemEditor.java

/**
 * Creates the user interface components of this dialog.
 *///from  www  .  j ava 2 s .co  m
private void createUI() {

    JPanel content = new JPanel();
    JLabel lblTaxonNumber = new JLabel("Taxon Number:");
    lblTaxonNumber.setName("taxonNumberLabel");

    spinner = new JSpinner();
    spinner.setModel(new SpinnerNumberModel(1, 1, 1, 1));

    btnSelect = new JToggleButton("Select");
    btnSelect.setName("selectTaxonNumberButton");

    lblEditTaxonName = new JLabel(editTaxonLabelText);

    rtfEditor = new RtfEditor();
    editorScroller = new JScrollPane(rtfEditor);

    chckbxTreatAsVariant = new JCheckBox("Treat as Variant");
    chckbxTreatAsVariant.setName("treatAsVariantCheckbox");

    JPanel panel = new JPanel();

    btnDone = new JButton("Done");
    btnDone.setName("doneEditingTaxonButton");

    taxonSelectionList = new ItemList();

    GroupLayout groupLayout = new GroupLayout(content);
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
                    .createSequentialGroup()
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addGroup(groupLayout.createSequentialGroup()
                                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
                                            .addComponent(spinner).addComponent(lblTaxonNumber,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE))
                                    .addGap(18).addComponent(btnSelect))
                            .addComponent(chckbxTreatAsVariant))
                    .addGap(23)
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblEditTaxonName)
                            .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 703, Short.MAX_VALUE)))
                    .addGroup(groupLayout.createSequentialGroup()
                            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(groupLayout.createSequentialGroup()
                                            .addGap(0, 759, Short.MAX_VALUE).addComponent(btnDone).addGap(5))
                                    .addComponent(panel, GroupLayout.DEFAULT_SIZE, 850, Short.MAX_VALUE))
                            .addGap(1)))
            .addGap(19)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblTaxonNumber)
                    .addComponent(lblEditTaxonName))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup()
                            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(spinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnSelect))
                            .addPreferredGap(ComponentPlacement.RELATED, 90, Short.MAX_VALUE)
                            .addComponent(chckbxTreatAsVariant))
                    .addComponent(editorScroller, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE))
            .addGap(18).addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnDone)).addGap(17)));
    panel.setLayout(new BorderLayout(0, 0));

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    imageDetails = new ImageDetailsPanel();
    imageDetails.setEnabled(false);
    tabbedPane.addTab("Images", imageDetails);
    panel.add(tabbedPane);
    content.setLayout(groupLayout);

    setPreferredSize(new Dimension(827, 500));
    setMinimumSize(new Dimension(748, 444));

    RtfToolBar toolbar = new RtfToolBar(this);
    toolbar.addEditor(rtfEditor);
    getContentPane().add(toolbar, BorderLayout.NORTH);
    getContentPane().add(content, BorderLayout.CENTER);
}

From source file:es.unex.meigas.extFillData.FittingDataPanel.java

private JSpinner getJSpinnerOrder() {

    if (jSpinnerOrder == null) {
        final SpinnerListModel jSpinnerOrderModel = new SpinnerListModel(
                new String[] { "1", "2", "3", "4", "5", "6", "7" });
        jSpinnerOrder = new JSpinner();
        jSpinnerOrder.setModel(jSpinnerOrderModel);
        jSpinnerOrder.addChangeListener(new ChangeListener() {
            public void stateChanged(final ChangeEvent evt) {
                String s = (String) ((SpinnerListModel) jSpinnerOrder.getModel()).getValue();
                m_Lsf.calculate(Integer.parseInt(s));
                updateDataset();/*from  w w  w.  jav a  2s  .c o m*/
                s = m_Lsf.getExpression();
                getJLabel().setText("Ecuacion de ajuste: y = " + s);
            }
        });
    }

    return jSpinnerOrder;

}