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(SpinnerModel model) 

Source Link

Document

Constructs a spinner for the given model.

Usage

From source file:pl.otros.logview.gui.actions.StartSocketListener.java

private LogImporterAndPort chooseLogImporter() {
    Collection<LogImporter> elements = AllPluginables.getInstance().getLogImportersContainer().getElements();
    LogImporter[] importers = elements.toArray(new LogImporter[0]);
    String[] names = new String[elements.size()];
    for (int i = 0; i < names.length; i++) {
        names[i] = importers[i].getName();
    }//from w w  w .  j a  v a2s  .  c o m

    JComboBox box = new JComboBox(names);
    SpinnerNumberModel numberModel = new SpinnerNumberModel(50505, 1025, 65000, 1);
    JSpinner jSpinner = new JSpinner(numberModel);
    MigLayout migLayout = new MigLayout();
    JPanel panel = new JPanel(migLayout);
    panel.add(new JLabel("Select log importer"));
    panel.add(box, "wrap");
    panel.add(new JLabel("Select port"));
    panel.add(jSpinner, "span");

    if (logReaders.size() > 0) {
        panel.add(new JLabel("Opened sockets"), "wrap, growx");
        JTable jTable = new JTable(logReaders.size(), 2);
        jTable.getTableHeader().getColumnModel().getColumn(0).setHeaderValue("Log importer");
        jTable.getTableHeader().getColumnModel().getColumn(1).setHeaderValue("Port");
        int row = 0;
        for (SocketLogReader socketLogReader : logReaders) {
            jTable.setValueAt(socketLogReader.getLogImporter().getName(), row, 0);
            jTable.setValueAt(Integer.toString(socketLogReader.getPort()), row, 1);
            row++;
        }
        JScrollPane jScrollPane = new JScrollPane(jTable);
        panel.add(jScrollPane, "wrap, span");
    }
    int showConfirmDialog = JOptionPane.showConfirmDialog(null, panel, "Choose log importer and port",
            JOptionPane.OK_CANCEL_OPTION);
    if (showConfirmDialog != JOptionPane.OK_OPTION) {
        return null;
    }

    return new LogImporterAndPort(importers[box.getSelectedIndex()], numberModel.getNumber().intValue());
}

From source file:plugins.ImageRectificationPanel.java

public final void createGui() {
    this.removeAll();

    if (imageGCPsXCoords == null) {
        return;/*from   w  ww  .  j  av  a2 s.c om*/
    }
    int i;
    int newN = 0;
    for (i = 0; i < imageGCPsXCoords.length; i++) {
        if (useGCP[i]) {
            newN++;
        }
    }
    double[] X1 = new double[newN];
    double[] Y1 = new double[newN];
    double[] X2 = new double[newN];
    double[] Y2 = new double[newN];

    int j = 0;
    for (i = 0; i < imageGCPsXCoords.length; i++) {
        if (useGCP[i]) {
            X1[j] = imageGCPsXCoords[i];
            Y1[j] = imageGCPsYCoords[i];
            X2[j] = mapGCPsXCoords[i];
            Y2[j] = mapGCPsYCoords[i];
            j++;
        }
    }

    calculateEquations(X1, Y1, X2, Y2);

    // gui stuff
    this.setLayout(new BorderLayout());

    DecimalFormat df = new DecimalFormat("###,###,##0.000");

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    JButton btnOK = createButton(bundle.getString("OK"), bundle.getString("OK"), "ok");
    JButton btnExit = createButton(bundle.getString("Close"), bundle.getString("Close"), "close");
    //JButton btnRefresh = createButton("Cancel", "Cancel");

    buttonPane.add(Box.createHorizontalStrut(10));
    buttonPane.add(btnOK);
    buttonPane.add(Box.createHorizontalStrut(5));
    //buttonPane.add(btnRefresh);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(btnExit);
    buttonPane.add(Box.createHorizontalGlue());

    progressBar = new JProgressBar(0, 100);
    buttonPane.add(progressBar);
    buttonPane.add(Box.createHorizontalStrut(5));
    cancel = new JLabel(bundle.getString("Cancel"));
    cancel.setForeground(Color.BLUE.darker());
    cancel.addMouseListener(this);
    buttonPane.add(cancel);
    buttonPane.add(Box.createHorizontalStrut(10));

    this.add(buttonPane, BorderLayout.SOUTH);

    Box mainBox = Box.createVerticalBox();
    mainBox.add(Box.createVerticalStrut(10));

    Box box1 = Box.createHorizontalBox();
    box1.add(Box.createHorizontalStrut(10));
    box1.add(new JLabel(bundle.getString("PolynomialOrder") + ": "));
    SpinnerModel model = new SpinnerNumberModel(polyOrder, //initial value
            1, //min
            5, //max
            1); //step

    polyOrderSpinner = new JSpinner(model);
    polyOrderSpinner.setPreferredSize(new Dimension(15, polyOrderSpinner.getPreferredSize().height));
    polyOrderSpinner.addChangeListener(this);

    JSpinner.DefaultEditor editor = (JSpinner.DefaultEditor) polyOrderSpinner.getEditor();
    editor.getTextField().setEnabled(true);
    editor.getTextField().setEditable(false);

    box1.add(polyOrderSpinner);
    box1.add(Box.createHorizontalGlue());
    JLabel label = new JLabel("RMSE: " + df.format(overallRMSE));
    box1.add(label);
    box1.add(Box.createHorizontalStrut(10));
    mainBox.add(box1);

    mainBox.add(Box.createVerticalStrut(10));

    // Create columns names
    int numPoints = imageGCPsXCoords.length;
    Object dataValues[][] = new Object[numPoints][7];
    j = 0;
    for (i = 0; i < numPoints; i++) {
        dataValues[i][0] = i + 1;
        dataValues[i][1] = df.format(imageGCPsXCoords[i]);
        dataValues[i][2] = df.format(imageGCPsYCoords[i]);
        dataValues[i][3] = df.format(mapGCPsXCoords[i]);
        dataValues[i][4] = df.format(mapGCPsYCoords[i]);
        if (useGCP[i]) {
            dataValues[i][5] = df.format(residualsXY[j]);
            j++;
        } else {
            dataValues[i][5] = null;
        }
        dataValues[i][6] = useGCP[i];
    }

    String columnNames[] = { "GCP", bundle.getString("Image") + " X", bundle.getString("Image") + " Y",
            bundle.getString("Map") + " X", bundle.getString("Map") + " Y", messages.getString("Error"),
            "Use" };

    DefaultTableModel tableModel = new DefaultTableModel(dataValues, columnNames);

    dataTable = new JTable(tableModel) {
        private static final long serialVersionUID = 1L;

        @Override
        public Class getColumnClass(int column) {
            switch (column) {
            case 0:
                return Integer.class;
            case 1:
                return String.class; //Double.class;
            case 2:
                return String.class; //Double.class;
            case 3:
                return String.class; //Double.class;
            case 4:
                return String.class; //Double.class;
            case 5:
                return String.class; //Double.class;
            case 6:
                return Boolean.class;
            default:
                return String.class; //Double.class;
            }
        }

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int index_row, int index_col) {
            Component comp = super.prepareRenderer(renderer, index_row, index_col);
            //even index, selected or not selected

            if (index_row % 2 == 0) {
                comp.setBackground(Color.WHITE);
                comp.setForeground(Color.BLACK);
            } else {
                comp.setBackground(new Color(225, 245, 255)); //new Color(210, 230, 255));
                comp.setForeground(Color.BLACK);
            }
            if (isCellSelected(index_row, index_col)) {
                comp.setForeground(Color.RED);
            }
            return comp;
        }
    };

    tableModel.addTableModelListener(this);

    TableCellRenderer rend = dataTable.getTableHeader().getDefaultRenderer();
    TableColumnModel tcm = dataTable.getColumnModel();
    //for (int j = 0; j < tcm.getColumnCount(); j += 1) {
    TableColumn tc = tcm.getColumn(0);
    TableCellRenderer rendCol = tc.getHeaderRenderer(); // likely null  
    if (rendCol == null) {
        rendCol = rend;
    }
    Component c = rendCol.getTableCellRendererComponent(dataTable, tc.getHeaderValue(), false, false, 0, 0);
    tc.setPreferredWidth(35);

    tc = tcm.getColumn(6);
    rendCol = tc.getHeaderRenderer(); // likely null  
    if (rendCol == null) {
        rendCol = rend;
    }
    c = rendCol.getTableCellRendererComponent(dataTable, tc.getHeaderValue(), false, false, 0, 6);
    tc.setPreferredWidth(35);

    JScrollPane scroll = new JScrollPane(dataTable);
    mainBox.add(scroll);

    this.add(mainBox, BorderLayout.CENTER);

    this.validate();
}

From source file:richtercloud.reflection.form.builder.typehandler.NumberTypeHandler.java

@Override
public Pair<JComponent, ComponentHandler<?>> handle(Type type, Number fieldValue, String fieldName,
        Class<?> declaringClass, final FieldUpdateListener<FieldUpdateEvent<Number>> updateListener,
        ReflectionFormBuilder reflectionFormBuilder)
        throws IllegalArgumentException, IllegalAccessException, FieldHandlingException {
    //@TODO: handle validaton annotations (should cover all cases, so no
    // need to develop own annotations
    JSpinner retValue = new JSpinner(new SpinnerNumberModel(fieldValue, null, null, 1));
    retValue.addChangeListener(new ChangeListener() {

        @Override// ww w .j av  a2 s  .com
        public void stateChanged(ChangeEvent e) {
            updateListener.onUpdate(new FieldUpdateEvent<>((Number) ((JSpinner) e.getSource()).getValue()));
        }
    });
    return new ImmutablePair<JComponent, ComponentHandler<?>>(retValue, this);
}

From source file:rita.ui.component.DialogSelectEnemies.java

/**
 * Initialize the contents of the frame.
 * // ww w .j a  va  2 s.c  om
 * @throws NoEnemiesException
 */
private void initialize() throws NoEnemiesException {
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.getContentPane().setLayout(new BorderLayout(6, 6));
    this.setTitle(Language.get("selectEnemies"));
    randomMode = new JCheckBox(Language.get("robotsBattleMode.random"));
    randomMode.setSelected(true);
    randomMode.addActionListener(new SelectUnselectPositionAction());

    icon = new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/target.jpg"));

    JPanel panelRobots = new JPanel();
    panelRobots.setBorder(new EmptyBorder(0, 12, 12, 0));
    panelRobots.setLayout(new BorderLayout(0, 0));

    JPanel panelSelectAllNone = new JPanel();
    panelSelectAllNone.setBorder(new EmptyBorder(0, 12, 0, 12));
    panelRobots.add(panelSelectAllNone, BorderLayout.EAST);
    this.getContentPane().add(panelRobots, BorderLayout.CENTER);

    GridBagLayout gbl_panelSelectAllNone = new GridBagLayout();
    gbl_panelSelectAllNone.columnWidths = new int[] { 0, 0 };
    gbl_panelSelectAllNone.rowHeights = new int[] { 0, 0, 8 };
    gbl_panelSelectAllNone.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl_panelSelectAllNone.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panelSelectAllNone.setLayout(gbl_panelSelectAllNone);

    JButton btnSelectAll = new JButton(Language.get("selectAllEnemies"));
    GridBagConstraints gbc_btnSelectAll = new GridBagConstraints();
    gbc_btnSelectAll.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnSelectAll.insets = new Insets(0, 0, 5, 0);
    gbc_btnSelectAll.gridx = 0;
    gbc_btnSelectAll.gridy = 0;
    panelSelectAllNone.add(btnSelectAll, gbc_btnSelectAll);

    JButton btnSelectNone = new JButton(Language.get("selectNoEnemies"));
    GridBagConstraints gbc_btnSelectNone = new GridBagConstraints();
    gbc_btnSelectNone.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnSelectNone.gridx = 0;
    gbc_btnSelectNone.gridy = 1;
    panelSelectAllNone.add(btnSelectNone, gbc_btnSelectNone);

    /*
     * btnInitialPositionsConfig = new
     * JButton(Language.get("selectRobotsInitialPositions"));
     * GridBagConstraints gbc_btnInitialPositionsConfig = new
     * GridBagConstraints(); gbc_btnSelectNone.fill =
     * GridBagConstraints.HORIZONTAL; gbc_btnSelectNone.gridx = 0;
     * gbc_btnSelectNone.gridy = 1;
     * panelSelectAllNone.add(btnInitialPositionsConfig,
     * gbc_btnInitialPositionsConfig);
     * btnInitialPositionsConfig.addActionListener(new ActionListener() {
     * public void actionPerformed(ActionEvent evt) {
     * selectRobotsInitialPositions(); } });
     */

    JLabel label = new JLabel(String.format(Language.get("youtRobotAgainst"), HelperEditor.currentRobotName));
    label.setBorder(new EmptyBorder(12, 12, 0, 12));
    label.setIcon(new ImageIcon(DialogSelectEnemies.class.getResource("/images/icons/compite2.png")));
    label.setVerticalAlignment(SwingConstants.TOP);
    label.setFont(label.getFont().deriveFont(Font.BOLD, 14));

    panelSelectRobots = new JPanel();
    panelSelectRobots.setLayout(new GridLayout(0, 2));
    panelSelectRobots.setAutoscrolls(true);

    panelRobots.add(label, BorderLayout.NORTH);
    panelRobots.add(panelSelectRobots, BorderLayout.CENTER);

    // posicion de mi robot
    JPanel panelSetMyRobotPosition = new JPanel();
    // panelRobots.add(panelSetMyRobotPosition, BorderLayout.PAGE_END);
    panelSetMyRobotPosition.setLayout(new FlowLayout());
    JLabel ownPosition = new JLabel(Language.get("myRobotPosition") + " " + HelperEditor.currentRobotName);
    ownPosition.setFont(new Font("sansserif", Font.BOLD, 12));
    panelSetMyRobotPosition.add(ownPosition);
    // Posicion de mi robot
    buttonPos = new JButton(icon);
    buttonPos.addActionListener(new PosicionRobotAction(HelperEditor.currentRobotName)); // el nombre aqui es solo a
    // modo informativo
    buttonPos.setPreferredSize(new Dimension(30, 30));
    panelSetMyRobotPosition.add(buttonPos);
    positionComponents.add(buttonPos);

    // Matas
    JPanel panelSelectRoundsNumber = new JPanel();
    // panelRobots.add(panelSelectRoundsNumber, BorderLayout.SOUTH);
    panelSelectRoundsNumber.setLayout(new FlowLayout());
    panelSelectRoundsNumber.add(new JLabel(Language.get("selectRoundsNumber")));
    //      this.roundsNumberTextField = new JTextField(
    //            Integer.toString(Batalla.NUMBER_OF_ROUNDS), 5);
    this.roundsNumberSpinner = new JSpinner(new SpinnerNumberModel(Batalla.NUMBER_OF_ROUNDS,
            Batalla.MIN_NUMBER_OF_ROUNDS, Batalla.MAX_NUMBER_OF_ROUNDS, 1));

    panelSelectRoundsNumber.add(this.roundsNumberSpinner);

    JPanel panelSouth = new JPanel();
    panelSouth.setLayout(new GridLayout(4, 1));

    panelSouth.add(panelSetMyRobotPosition);
    //this.getContentPane().add(randomMode, BorderLayout.SOUTH);
    panelSouth.add(randomMode);
    panelSouth.add(new JSeparator());
    panelSouth.add(panelSelectRoundsNumber);
    panelRobots.add(panelSouth, BorderLayout.SOUTH);

    JPanel panelOkCancel = new JPanel();
    this.getContentPane().add(panelOkCancel, BorderLayout.SOUTH);
    panelOkCancel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 12));

    btnOK = new JButton(Language.get("selectStartBattle"));
    btnOK.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            startBattle(panelSelectRobots);
        }
    });
    // comienza deshabilitado hasta que se seleccione 1 enemigo
    // btnOK.setEnabled(false);
    panelOkCancel.add(btnOK);

    JButton btnCancel = new JButton(Language.get("cancel"));
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeDialog();
        }
    });
    panelOkCancel.add(btnCancel);

    btnSelectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            selectChecks(panelSelectRobots, true);
            // btnOK.setEnabled(true);
        }
    });

    btnSelectNone.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            selectChecks(panelSelectRobots, false);
            // btnOK.setEnabled(false);
        }
    });

    // TODO Agregar funcionalidad de elegir las posiciones iniciales de los
    // robots.
    // TODO Averiguar como pasar las posiciones para que se elijan de manera
    // random, probar (0,0,0)

    try {
        robotNameClicked = new RobotNameClickedEvent(btnOK);
        addRobotsToPanel(panelSelectRobots);

        this.setResizable(false);
        this.pack();
        PositionCalc.centerDialog(this);
        enablePositionOptions(false);
        this.setVisible(true);
    } catch (FileNotFoundException e) {
        throw new NoEnemiesException(e.getMessage());
    }

}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private Component makeUpperPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;//  www  .  j a  v a 2  s.c  o m
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel(getString(KEY_TYPE)));
    typeChooser = new TypeChooser(true);
    typePanel.add(typeChooser);
    typePanel.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    typeChooser.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    ret.add(typePanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel levelPanel = new JPanel();
    levelPanel.add(new JLabel(getString(KEY_LEVEL)));
    SpinnerNumberModel snm = new SpinnerNumberModel(0, 0, Species.MAX_LEVEL, 1);
    levelSpinner = new JSpinner(snm);
    levelPanel.add(levelSpinner);
    levelPanel.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    levelSpinner.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    JButton applyAllButton = new JButton(getString(KEY_SET_FOR_ALL));
    applyAllButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            applyLevelToAll();
        }
    });
    applyAllButton.setToolTipText(getString(KEY_SET_FOR_ALL_TOOLTIP));
    levelPanel.add(applyAllButton);
    ret.add(levelPanel, c);

    c.gridx += 1;
    c.weightx = 1.0;
    JPanel stringPanel = new JPanel(new GridBagLayout());
    GridBagConstraints sc = new GridBagConstraints();
    sc.fill = GridBagConstraints.HORIZONTAL;
    sc.gridx = 1;
    stringPanel.add(new JLabel(getString(KEY_NAME)), sc);
    textField = new JTextField();
    sc.gridx += 1;
    sc.weightx = 1.0;
    sc.insets = new Insets(0, 5, 0, 5);
    stringPanel.add(textField, sc);
    stringPanel.setToolTipText(getString(KEY_NAME_TOOLTIP));
    textField.setToolTipText(getString(KEY_NAME_TOOLTIP));
    ret.add(stringPanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    megaFilter = new JCheckBox(getString(KEY_MEGA_FILTER));
    megaFilter.setToolTipText(getString(KEY_MEGA_FILTER_TOOLTIP));
    ret.add(megaFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    effectFilter = new EffectChooser(false, EffectChooser.DefaultEntry.NO_FILTER);
    effectFilter.setToolTipText(getString(KEY_EFFECT_FILTER_TOOLTIP));
    ret.add(effectFilter, c);

    getMinUpperPanel = new Supplier<Dimension>() {

        @Override
        public Dimension get() {
            Dimension ret = new Dimension(10 + 50, 0);
            for (Component c : new Component[] { typePanel, levelPanel, stringPanel, megaFilter,
                    effectFilter }) {
                Dimension temp = c.getPreferredSize();
                int width = temp.width + ret.width;
                int height = Math.max(temp.height, ret.height);
                ret.setSize(width, height);
            }
            return ret;
        }
    };

    return ret;
}

From source file:shuffle.fwk.service.teams.EditTeamService.java

private Component makeUpperPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;/*from   w  w w. j a  v  a 2 s . com*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel(getString(KEY_TYPE)));
    typeChooser = new TypeChooser(true);
    typePanel.add(typeChooser);
    typePanel.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    typeChooser.setToolTipText(getString(KEY_TYPE_TOOLTIP));
    ret.add(typePanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    JPanel levelPanel = new JPanel();
    levelPanel.add(new JLabel(getString(KEY_LEVEL)));
    SpinnerNumberModel snm = new SpinnerNumberModel(0, 0, Species.MAX_LEVEL, 1);
    levelSpinner = new JSpinner(snm);
    levelPanel.add(levelSpinner);
    levelPanel.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    levelSpinner.setToolTipText(getString(KEY_LEVEL_TOOLTIP));
    ret.add(levelPanel, c);

    c.gridx += 1;
    c.weightx = 1.0;
    JPanel stringPanel = new JPanel(new GridBagLayout());
    GridBagConstraints sc = new GridBagConstraints();
    sc.fill = GridBagConstraints.HORIZONTAL;
    sc.gridx = 1;
    stringPanel.add(new JLabel(getString(KEY_NAME)), sc);
    textField = new JTextField();
    sc.gridx += 1;
    sc.weightx = 1.0;
    sc.insets = new Insets(0, 5, 0, 5);
    stringPanel.add(textField, sc);
    stringPanel.setToolTipText(getString(KEY_NAME_TOOLTIP));
    textField.setToolTipText(getString(KEY_NAME_TOOLTIP));
    ret.add(stringPanel, c);

    c.gridx += 1;
    c.weightx = 0.0;
    megaFilter = new JCheckBox(getString(KEY_MEGA_FILTER));
    megaFilter.setToolTipText(getString(KEY_MEGA_FILTER_TOOLTIP));
    ;
    ret.add(megaFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    effectFilter = new EffectChooser(false, EffectChooser.DefaultEntry.NO_FILTER);
    effectFilter.setToolTipText(getString(KEY_EFFECT_FILTER_TOOLTIP));
    ret.add(effectFilter, c);

    c.gridx += 1;
    c.weightx = 0.0;
    @SuppressWarnings("serial")
    JButton copyToLauncher = new JButton(new AbstractAction(getString(KEY_MAKE_DEFAULT)) {
        @Override
        public void actionPerformed(ActionEvent e) {
            makeTeamDefault();
        }
    });
    copyToLauncher.setToolTipText(getString(KEY_MAKE_DEFAULT_TOOLTIP));
    ret.add(copyToLauncher, c);

    getMinUpperPanel = new Supplier<Dimension>() {

        @Override
        public Dimension get() {
            Dimension ret = new Dimension(10 + 50, 0);
            for (Component c : new Component[] { typePanel, levelPanel, stringPanel, megaFilter, effectFilter,
                    copyToLauncher }) {
                Dimension temp = c.getPreferredSize();
                int width = temp.width + ret.width;
                int height = Math.max(temp.height, ret.height);
                ret.setSize(width, height);
            }
            return ret;
        }
    };

    return ret;
}

From source file:storybook.toolkit.swing.panel.DateChooser.java

@Override
public void initUi() {
    setLayout(new MigLayout("flowx, ins 0"));

    dateChooser = new JDateChooser();
    dateChooser.setDateFormatString(//  ww w  .  j a  v  a2  s . com
            PrefUtil.get(SbConstants.PreferenceKey.DATEFORMAT, "MM-dd-yyyy").getStringValue());
    dateChooser.setMinimumSize(new Dimension(120, 20));

    JLabel lbTime = new JLabel(I18N.getMsgColon("msg.common.time"));

    IconButton btClearTime = new IconButton("icon.small.clear", getClearTimeAction());
    btClearTime.setSize20x20();

    timeSpinner = new JSpinner(new SpinnerDateModel());
    JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, I18N.TIME_FORMAT);
    timeSpinner.setEditor(timeEditor);
    timeSpinner.setValue(DateUtil.getZeroTimeDate());
    timeSpinner.setPreferredSize(new Dimension(80, 30));

    IconButton btFirstDate = new IconButton("icon.small.first", getFirstDateAction());
    btFirstDate.setSize20x20();

    IconButton btPrevDay = new IconButton("icon.small.previous", getPrevDayAction());
    btPrevDay.setSize20x20();

    IconButton btNextDay = new IconButton("icon.small.next", getNextDayAction());
    btNextDay.setSize20x20();

    IconButton btLastDate = new IconButton("icon.small.last", getLastDateAction());
    btLastDate.setSize20x20();

    // layout
    add(dateChooser, "gapafter 10");
    add(btFirstDate);
    add(btPrevDay);
    add(btNextDay);
    add(btLastDate);
    if (showDateTime) {
        add(lbTime, "aligny center,newline,span,split 3");
        add(timeSpinner);
        add(btClearTime);
    }
}

From source file:tvbrowser.extras.reminderplugin.ReminderSettingsTab.java

/**
 * Creates the settings panel for this tab.
 *//*from   ww w  .j  av a 2s.com*/
public JPanel createSettingsPanel() {
    FormLayout layout = new FormLayout("5dlu,pref,5dlu,pref,pref:grow,3dlu,pref,3dlu,pref,5dlu",
            "pref,5dlu,pref,1dlu,pref,1dlu,pref,1dlu,pref,10dlu,pref,5dlu,"
                    + "pref,10dlu,pref,5dlu,pref,10dlu,pref,5dlu,pref,10dlu,"
                    + "pref,5dlu,pref,3dlu,pref,10dlu,pref,5dlu,pref");
    layout.setColumnGroups(new int[][] { { 7, 9 } });
    PanelBuilder pb = new PanelBuilder(layout, new ScrollableJPanel());
    pb.setDefaultDialogBorder();

    CellConstraints cc = new CellConstraints();

    final String[] extArr = { ".wav", ".aif", ".rmf", ".au", ".mid" };
    String soundFName = mSettings.getProperty("soundfile", "/");
    String msg = mLocalizer.msg("soundFileFilter", "Sound file ({0})", "*" + StringUtils.join(extArr, ", *"));

    mReminderWindowChB = new JCheckBox(mLocalizer.msg("reminderWindow", "Reminder window"),
            mSettings.getProperty("usemsgbox", "false").equalsIgnoreCase("true"));

    mShowAlwaysOnTop = new JCheckBox(mLocalizer.msg("alwaysOnTop", "Show always on top"),
            mSettings.getProperty("alwaysOnTop", "true").equalsIgnoreCase("true"));
    mShowAlwaysOnTop.setEnabled(mReminderWindowChB.isSelected());

    JPanel reminderWindowCfg = new JPanel(new FormLayout("12dlu,default:grow", "pref,1dlu,pref"));
    reminderWindowCfg.add(mReminderWindowChB, cc.xyw(1, 1, 2));
    reminderWindowCfg.add(mShowAlwaysOnTop, cc.xy(2, 3));

    mSoundFileChB = new FileCheckBox(mLocalizer.msg("playlingSound", "Play sound"), new File(soundFName), 0,
            false);

    JFileChooser soundChooser = new JFileChooser((String) null);
    soundChooser.setFileFilter(new ExtensionFileFilter(extArr, msg));

    mSoundFileChB.setFileChooser(soundChooser);

    mSoundFileChB.setSelected(mSettings.getProperty("usesound", "false").equals("true"));

    mBeep = new JCheckBox(mLocalizer.msg("beep", "Speaker sound"),
            mSettings.getProperty("usebeep", "true").equalsIgnoreCase("true"));

    mExecFileStr = mSettings.getProperty("execfile", "");
    mExecParamStr = mSettings.getProperty("execparam", "");

    final JButton soundTestBt = new JButton(mLocalizer.msg("test", "Test"));

    mExecChB = new JCheckBox(mLocalizer.msg("executeProgram", "Execute program"));
    mExecChB.setSelected(mSettings.getProperty("useexec", "false").equals("true"));

    mExecFileDialogBtn = new JButton(mLocalizer.msg("executeConfig", "Configure"));
    mExecFileDialogBtn.setEnabled(mExecChB.isSelected());

    mPluginLabel = new JLabel();
    JButton choose = new JButton(mLocalizer.msg("selectPlugins", "Choose Plugins"));

    mClientPluginTargets = ReminderPlugin.getInstance().getClientPluginsTargets();

    handlePluginSelection();

    choose.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
                PluginChooserDlg chooser = null;
                chooser = new PluginChooserDlg(parent, mClientPluginTargets, null,
                        ReminderPluginProxy.getInstance());

                chooser.setLocationRelativeTo(parent);
                chooser.setVisible(true);

                if (chooser.getReceiveTargets() != null) {
                    mClientPluginTargets = chooser.getReceiveTargets();
                }

                handlePluginSelection();
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }
    });

    int autoCloseReminderTime = 10;
    try {
        String asString = mSettings.getProperty("autoCloseReminderTime", "10");
        autoCloseReminderTime = Integer.parseInt(asString);

        if (autoCloseReminderTime == 0) {
            autoCloseReminderTime = 10;
        }
    } catch (Exception exc) {
        // ignore
    }

    mCloseOnEnd = new JRadioButton(mLocalizer.msg("autoCloseReminderAtProgramEnd", "Program end"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onEnd"));
    mCloseOnEnd.setEnabled(mReminderWindowChB.isSelected());

    mCloseNever = new JRadioButton(mLocalizer.msg("autoCloseNever", "Never close"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("never"));
    mCloseNever.setEnabled(mReminderWindowChB.isSelected());

    mCloseOnTime = new JRadioButton(mLocalizer.ellipsisMsg("autoCloseAfterTime", "After time"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onTime"));
    mCloseOnTime.setEnabled(mReminderWindowChB.isSelected());

    ButtonGroup bg = new ButtonGroup();

    bg.add(mCloseOnEnd);
    bg.add(mCloseNever);
    bg.add(mCloseOnTime);

    mAutoCloseReminderTimeSp = new JSpinner(
            new SpinnerNumberModel(autoCloseReminderTime, autoCloseReminderTime < 5 ? 1 : 5, 600, 1));
    mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());

    mShowTimeCounter = new JCheckBox(mLocalizer.msg("showTimeCounter", "Show time counter"),
            mSettings.getProperty("showTimeCounter", "false").compareTo("true") == 0);
    mShowTimeCounter.setEnabled(!mCloseNever.isSelected() && mReminderWindowChB.isSelected());

    PanelBuilder autoClosePanel = new PanelBuilder(
            new FormLayout("12dlu,default,2dlu,default:grow", "pref,2dlu,pref,2dlu,pref,2dlu,pref,10dlu,pref"));
    autoClosePanel.add(mCloseOnEnd, cc.xyw(1, 1, 4));
    autoClosePanel.add(mCloseNever, cc.xyw(1, 3, 4));
    autoClosePanel.add(mCloseOnTime, cc.xyw(1, 5, 4));
    autoClosePanel.add(mAutoCloseReminderTimeSp, cc.xy(2, 7));

    final JLabel secondsLabel = autoClosePanel.addLabel(mLocalizer.msg("seconds", "seconds (0 = off)"),
            cc.xy(4, 7));

    autoClosePanel.add(mShowTimeCounter, cc.xyw(1, 9, 4));

    secondsLabel.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());

    String defaultReminderEntryStr = (String) mSettings.get("defaultReminderEntry");
    mDefaultReminderEntryList = new JComboBox(ReminderDialog.SMALL_REMIND_MSG_ARR);
    if (defaultReminderEntryStr != null) {
        try {
            int inx = Integer.parseInt(defaultReminderEntryStr);
            if (inx < ReminderDialog.SMALL_REMIND_MSG_ARR.length) {
                mDefaultReminderEntryList.setSelectedIndex(inx);
            }
        } catch (NumberFormatException e) {
            // ignore
        }
    }

    mShowTimeSelectionDlg = new JCheckBox(
            mLocalizer.msg("showTimeSelectionDialog", "Show time selection dialog"));
    mShowTimeSelectionDlg
            .setSelected(mSettings.getProperty("showTimeSelectionDialog", "true").compareTo("true") == 0);
    mShowRemovedDlg = new JCheckBox(
            mLocalizer.msg("showRemovedDialog", "Show removed reminders after data update"));
    mShowRemovedDlg.setSelected(mSettings.getProperty("showRemovedDialog", "true").compareTo("true") == 0);

    pb.addSeparator(mLocalizer.msg("remindBy", "Remind me by"), cc.xyw(1, 1, 10));

    pb.add(reminderWindowCfg, cc.xyw(2, 3, 4));
    pb.add(mSoundFileChB, cc.xyw(2, 5, 4));
    pb.add(mSoundFileChB.getButton(), cc.xy(7, 5));
    pb.add(soundTestBt, cc.xy(9, 5));
    pb.add(mBeep, cc.xy(2, 7));
    pb.add(mExecChB, cc.xyw(2, 9, 4));
    pb.add(mExecFileDialogBtn, cc.xyw(7, 9, 3));

    pb.addSeparator(mLocalizer.msg("sendToPlugin", "Send reminded program to"), cc.xyw(1, 11, 10));

    pb.add(mPluginLabel, cc.xyw(2, 13, 4));
    pb.add(choose, cc.xyw(7, 13, 3));

    final JLabel c = (JLabel) pb
            .addSeparator(mLocalizer.msg("autoCloseReminder", "Automatically close reminder"),
                    cc.xyw(1, 15, 10))
            .getComponent(0);
    c.setEnabled(mReminderWindowChB.isSelected());

    pb.add(autoClosePanel.getPanel(), cc.xyw(2, 17, 5));

    JPanel reminderEntry = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    reminderEntry.add(mDefaultReminderEntryList);

    pb.addSeparator(mLocalizer.msg("defaltReminderEntry", "Default reminder time"), cc.xyw(1, 19, 10));
    pb.add(reminderEntry, cc.xyw(2, 21, 4));

    pb.addSeparator(mLocalizer.msg("miscSettings", "Misc settings"), cc.xyw(1, 23, 10));
    pb.add(mShowTimeSelectionDlg, cc.xyw(2, 25, 7));
    pb.add(mShowRemovedDlg, cc.xyw(2, 27, 7));

    pb.addSeparator(DefaultMarkingPrioritySelectionPanel.getTitle(), cc.xyw(1, 29, 10));
    pb.add(mMarkingsPanel = DefaultMarkingPrioritySelectionPanel
            .createPanel(ReminderPlugin.getInstance().getMarkPriority(), false, false), cc.xyw(2, 31, 9));

    mReminderWindowChB.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mShowAlwaysOnTop.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            c.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            secondsLabel.setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
            mCloseOnEnd.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mCloseNever.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mCloseOnTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED && !mCloseNever.isSelected());
            mAutoCloseReminderTimeSp
                    .setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
        }
    });

    soundTestBt.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (evt.getActionCommand().compareTo(mLocalizer.msg("test", "Test")) == 0) {
                mTestSound = ReminderPlugin.playSound(mSoundFileChB.getTextField().getText());
                if (mTestSound != null) {
                    soundTestBt.setText(mLocalizer.msg("stop", "Stop"));
                }
                if (mTestSound != null) {
                    if (mTestSound instanceof SourceDataLine) {
                        ((SourceDataLine) mTestSound).addLineListener(new LineListener() {
                            public void update(LineEvent event) {
                                if (event.getType() == Type.CLOSE) {
                                    soundTestBt.setText(mLocalizer.msg("test", "Test"));
                                }
                            }
                        });
                    } else if (mTestSound instanceof Sequencer) {
                        new Thread("Test MIDI sound") {
                            public void run() {
                                setPriority(Thread.MIN_PRIORITY);
                                while (((Sequencer) mTestSound).isRunning()) {
                                    try {
                                        Thread.sleep(100);
                                    } catch (Exception ee) {
                                    }
                                }

                                soundTestBt.setText(mLocalizer.msg("test", "Test"));
                            }
                        }.start();
                    }
                }
            } else if (mTestSound != null) {
                if (mTestSound instanceof SourceDataLine && ((SourceDataLine) mTestSound).isRunning()) {
                    ((SourceDataLine) mTestSound).stop();
                } else if (mTestSound instanceof Sequencer && ((Sequencer) mTestSound).isRunning()) {
                    ((Sequencer) mTestSound).stop();
                }
            }
        }
    });

    mSoundFileChB.getCheckBox().addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            soundTestBt.setEnabled(mSoundFileChB.isSelected());
        }
    });

    mSoundFileChB.getTextField().addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            String text = mSoundFileChB.getTextField().getText();
            if ((new File(text)).isFile()) {
                boolean notFound = true;
                for (String extension : extArr) {
                    if (StringUtils.endsWithIgnoreCase(text, extension)) {
                        notFound = false;
                        break;
                    }
                }

                if (notFound) {
                    soundTestBt.setEnabled(false);
                } else {
                    soundTestBt.setEnabled(true);
                }
            } else {
                soundTestBt.setEnabled(false);
            }
        }
    });
    mSoundFileChB.getTextField().getKeyListeners()[0].keyReleased(null);

    mExecChB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            mExecFileDialogBtn.setEnabled(mExecChB.isSelected());
            if (mExecFileDialogBtn.isEnabled()) {
                showFileSettingsDialog();
            }
        }
    });

    mExecFileDialogBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showFileSettingsDialog();
        }
    });

    ItemListener autoCloseListener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected());
            secondsLabel.setEnabled(mCloseOnTime.isSelected());
            mShowTimeCounter.setEnabled(mCloseOnTime.isSelected() || mCloseOnEnd.isSelected());
        }
    };

    mCloseOnEnd.addItemListener(autoCloseListener);
    mCloseOnTime.addItemListener(autoCloseListener);

    mCloseOnTime.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    JScrollPane scrollPane = new JScrollPane(pb.getPanel());
    scrollPane.setBorder(null);
    scrollPane.setViewportBorder(null);

    JPanel scrollPanel = new JPanel(new FormLayout("default:grow", "default"));
    scrollPanel.add(scrollPane, cc.xy(1, 1));

    return scrollPanel;
}

From source file:ui.panel.UILicenseAdd.java

private JPanel createSettingPnl() {
    JPanel panel = p.createPanel(Layouts.gridbag);
    GridBagConstraints g = new GridBagConstraints();

    lblCloud = l.createLabel("Cloud Storage (GB):", SwingConstants.LEFT);
    g.gridx = 0;//from   w ww  .  j a  va2  s.c o  m
    g.gridy = 0;
    g.gridwidth = 2;
    g.insets = new Insets(5, 5, 5, 5);
    g.anchor = g.FIRST_LINE_START;
    panel.add(lblCloud, g);

    lblValidity = l.createLabel("Validity Period (Months):", SwingConstants.LEFT);
    g.gridx = 0;
    g.gridy = 1;
    g.gridwidth = 2;
    g.weighty = 1.0;
    g.insets = new Insets(5, 5, 5, 5);
    panel.add(lblValidity, g);

    lblConcurrentVCA = l.createLabel("Max Concurrent VCA:", SwingConstants.LEFT);
    g.gridx = 0;
    g.gridy = 2;
    g.gridwidth = 2;
    g.weighty = 1.0;
    g.insets = new Insets(5, 5, 5, 5);
    g.anchor = g.LAST_LINE_START;
    panel.add(lblConcurrentVCA, g);

    spnCloud = new JSpinner(new SpinnerNumberModel(1, 0, 1, 1));
    spnCloud.setPreferredSize(new Dimension(50, 25));
    g.gridx = 2;
    g.gridy = 0;
    g.gridwidth = 2;
    g.fill = GridBagConstraints.VERTICAL;
    panel.add(spnCloud, g);

    spnValidity = new JSpinner(new SpinnerNumberModel(24, 1, 24, 1));
    spnValidity.setPreferredSize(new Dimension(50, 25));
    g.gridx = 2;
    g.gridy = 1;
    g.gridwidth = 2;
    g.fill = GridBagConstraints.VERTICAL;
    panel.add(spnValidity, g);

    spnConcurrentVCA = new JSpinner(new SpinnerNumberModel(1, 1, 4, 1));
    spnConcurrentVCA.setPreferredSize(new Dimension(50, 25));
    g.gridx = 2;
    g.gridy = 2;
    g.gridwidth = 2;
    g.fill = GridBagConstraints.VERTICAL;
    panel.add(spnConcurrentVCA, g);

    cbPerpetual = new JCheckBox("Perpetual");
    cbPerpetual.setBackground(CustomColor.NavyBlue.returnColor());
    cbPerpetual.setForeground(CustomColor.Grey.returnColor());
    cbPerpetual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (cbPerpetual.isSelected()) {
                spnValidity.setEnabled(false);
            } else {
                spnValidity.setEnabled(true);
            }
        }
    });
    g.gridx = 5;
    g.gridy = 1;
    g.weighty = 1.0;
    g.fill = GridBagConstraints.VERTICAL;
    panel.add(cbPerpetual, g);

    return panel;
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.ConstraintPanel.java

/**
 * Inits the components.//from  www .jav a 2 s .c  om
 */
private void initComponents() {

    String[] fields = new String[] { "has_dose", "has_value" };
    fieldBox = new JComboBox(fields);
    fieldBox.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent arg0) {
            // get selected item
            selectedField = fieldBox.getSelectedItem().toString();
        }
    });
    // select has_value by default
    fieldBox.setSelectedItem(fields[1]);
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add(new JLabel("Field Name"));
    p1.add(Box.createHorizontalStrut(10));
    p1.add(fieldBox);

    Operator[] ops = { Operator.EQUAL_TO, Operator.BETWEEN, Operator.LESS_THAN, Operator.GREATER_THAN };
    operatorsBox = new JComboBox(ops);
    // select operator 'equal to' by default
    operatorsBox.setSelectedItem(Operator.EQUAL_TO);
    selectedOperator = Operator.EQUAL_TO;
    operatorsBox.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            // get selected operator
            selectedOperator = Operator.valueOf(operatorsBox.getSelectedItem().toString());

            if (selectedOperator == Operator.BETWEEN) {
                // enable second value spinner
                valueSpinner2.setEnabled(true);
                valueSpinnerCheckBox2.setEnabled(true);
            } else if (selectedOperator == Operator.EQUAL_TO) {
                // disable value 1 checkbox
                valueSpinnerCheckBox1.setEnabled(false);

                // disable value spinner 2
                valueSpinner2.setEnabled(false);
                valueSpinnerCheckBox2.setEnabled(false);
            } else {
                // disable value 1 checkbox
                valueSpinnerCheckBox1.setEnabled(true);

                // disable value spinner 2
                valueSpinner2.setEnabled(false);
                valueSpinnerCheckBox2.setEnabled(false);
            }
        }
    });
    JPanel p2 = new JPanel();
    p2.setLayout(new BoxLayout(p2, BoxLayout.LINE_AXIS));
    p2.add(new JLabel("Operator"));
    p2.add(Box.createHorizontalStrut(20));
    p2.add(operatorsBox);

    // create spinners
    SpinnerNumberModel model1 = new SpinnerNumberModel(0, 0, 10000, 0.1);
    SpinnerNumberModel model2 = new SpinnerNumberModel(0, 0, 10000, 0.1);
    valueSpinner1 = new JSpinner(model1);
    valueSpinner1.setName("valueSpinner1");
    valueSpinner2 = new JSpinner(model2);
    valueSpinner2.setName("valueSpinner2");
    // disable spinner 2 by default
    valueSpinner2.setEnabled(false);
    // create check boxes for inclusive ranges...
    valueSpinnerCheckBox1 = new JCheckBox(new AbstractAction("Inclusive") {

        public void actionPerformed(ActionEvent e) {
            value1Inclusive = valueSpinnerCheckBox1.isSelected();
        }
    });
    valueSpinnerCheckBox2 = new JCheckBox(new AbstractAction("Inclusive") {

        public void actionPerformed(ActionEvent e) {
            value2Inclusive = valueSpinnerCheckBox2.isSelected();
        }
    });
    JPanel p3 = new JPanel();
    p3.setLayout(new BoxLayout(p3, BoxLayout.LINE_AXIS));
    p3.add(new JLabel("Lower Bound"));
    p3.add(Box.createHorizontalStrut(10));
    p3.add(valueSpinner1);
    JPanel lowerBoundPanel = new JPanel(new GridLayout(0, 1));
    lowerBoundPanel.add(p3);
    lowerBoundPanel.add(valueSpinnerCheckBox1);
    JPanel p4 = new JPanel();
    p4.setLayout(new BoxLayout(p4, BoxLayout.LINE_AXIS));
    p4.add(new JLabel("Upper Bound"));
    p4.add(Box.createHorizontalStrut(10));
    p4.add(valueSpinner2);
    JPanel upperBoundPanel = new JPanel(new GridLayout(0, 1));
    upperBoundPanel.add(p4);
    upperBoundPanel.add(valueSpinnerCheckBox2);

    // set grid layout
    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    add(p1);
    add(p2);
    add(lowerBoundPanel);
    add(upperBoundPanel);
}