Search in sources :

Example 46 with ButtonGroup

use of javax.swing.ButtonGroup in project JMRI by JMRI.

the class WarrantFrame method makePlaybackPanel.

private JPanel makePlaybackPanel() {
    JPanel runPanel = new JPanel();
    runPanel.setLayout(new BoxLayout(runPanel, BoxLayout.LINE_AXIS));
    runPanel.add(Box.createHorizontalStrut(STRUT_SIZE));
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    //panel.add(Box.createVerticalStrut(STRUT_SIZE));
    JPanel bPanel = new JPanel();
    bPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton runButton = new JButton(Bundle.getMessage("ARun"));
    runButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            runTrain();
        }
    });
    bPanel.add(runButton);
    panel.add(bPanel);
    runPanel.add(panel);
    runPanel.add(Box.createHorizontalStrut(STRUT_SIZE));
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    ButtonGroup group = new ButtonGroup();
    group.add(_halt);
    group.add(_resume);
    group.add(_eStop);
    group.add(_abort);
    group.add(_invisible);
    panel.add(_halt);
    panel.add(_resume);
    panel.add(_eStop);
    panel.add(_abort);
    runPanel.add(panel);
    _halt.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doControlCommand(Warrant.HALT);
        }
    });
    _resume.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doControlCommand(Warrant.RESUME);
        }
    });
    _eStop.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doControlCommand(Warrant.ESTOP);
        }
    });
    _abort.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doControlCommand(Warrant.ABORT);
        }
    });
    runPanel.add(panel);
    if (_isSCWarrant.isSelected()) {
        setPanelEnabled(panel, false);
        setPanelEnabled(bPanel, false);
    }
    _isSCWarrant.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setPanelEnabled(runPanel, false);
            setPanelEnabled(bPanel, false);
        }
    });
    _isWarrant.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setPanelEnabled(runPanel, true);
            setPanelEnabled(bPanel, true);
        }
    });
    JPanel edge = new JPanel();
    edge.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(java.awt.Color.BLACK), Bundle.getMessage("RunTrain"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP));
    edge.add(runPanel);
    return edge;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton)

Example 47 with ButtonGroup

use of javax.swing.ButtonGroup in project JMRI by JMRI.

the class WarrantFrame method makeTypePanel.

private JPanel makeTypePanel() {
    JPanel typePanel = new JPanel();
    typePanel.setLayout(new BoxLayout(typePanel, BoxLayout.LINE_AXIS));
    typePanel.add(Box.createHorizontalStrut(STRUT_SIZE));
    JPanel wTypePanel = new JPanel();
    wTypePanel.setLayout(new BoxLayout(wTypePanel, BoxLayout.PAGE_AXIS));
    wTypePanel.add(Box.createVerticalStrut(STRUT_SIZE));
    ButtonGroup group = new ButtonGroup();
    group.add(_isSCWarrant);
    group.add(_isWarrant);
    _isSCWarrant.setToolTipText(Bundle.getMessage("SCW_Tooltip"));
    _isWarrant.setToolTipText(Bundle.getMessage("W_Tooltip"));
    wTypePanel.add(_isSCWarrant);
    wTypePanel.add(_isWarrant);
    typePanel.add(wTypePanel);
    _isSCWarrant.setSelected(_saveWarrant instanceof SCWarrant);
    JPanel edge = new JPanel();
    edge.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(java.awt.Color.BLACK), Bundle.getMessage("SelectType"), javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP));
    edge.add(typePanel);
    return edge;
}
Also used : JPanel(javax.swing.JPanel) ButtonGroup(javax.swing.ButtonGroup) BoxLayout(javax.swing.BoxLayout)

Example 48 with ButtonGroup

use of javax.swing.ButtonGroup in project JMRI by JMRI.

the class FrameServletPreferencesPanel method initComponents.

/**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    bindingGroup = new BindingGroup();
    framesEnabled = new ButtonGroup();
    preferences = InstanceManager.getDefault(WebServerPreferences.class);
    enableFramesPnl = new JPanel();
    enableFrames = new JRadioButton();
    clickDelay = new JSpinner();
    refreshDelay = new JSpinner();
    useAjax = new JCheckBox();
    refreshDelayLbl = new JLabel();
    clickDelayLbl = new JLabel();
    disallowedFramesLbl = new JLabel();
    jScrollPane1 = new JScrollPane();
    disallowedFrames = new EditableList<String>();
    disableFramesPnl = new JPanel();
    disableFrames = new JRadioButton();
    redirectToPanels = new JCheckBox();
    framesEnabled.add(enableFrames);
    framesEnabled.add(disableFrames);
    preferences.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            preferencesPropertyChange(evt);
        }
    });
    // NOI18N
    enableFrames.setText(Bundle.getMessage("LabelEnableFrames"));
    Binding binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, preferences, ELProperty.create("${!disableFrames}"), enableFrames, BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    clickDelay.setModel(new SpinnerNumberModel(1, 0, 999, 1));
    // NOI18N
    clickDelay.setToolTipText(Bundle.getMessage("ToolTipClickDelay"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${clickDelay}"), clickDelay, BeanProperty.create("value"));
    bindingGroup.addBinding(binding);
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), clickDelay, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    refreshDelay.setModel(new SpinnerNumberModel(5, 0, 999, 1));
    // NOI18N
    refreshDelay.setToolTipText(Bundle.getMessage("ToolTipRefreshDelay"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${refreshDelay}"), refreshDelay, BeanProperty.create("value"));
    bindingGroup.addBinding(binding);
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), refreshDelay, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    // NOI18N
    useAjax.setText(Bundle.getMessage("LabelUseAjax"));
    // NOI18N
    useAjax.setToolTipText(Bundle.getMessage("ToolTipUseAjax"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${useAjax}"), useAjax, BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), useAjax, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    // NOI18N
    refreshDelayLbl.setText(Bundle.getMessage("LabelRefreshDelay"));
    // NOI18N
    refreshDelayLbl.setToolTipText(Bundle.getMessage("ToolTipRefreshDelay"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), refreshDelayLbl, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    // NOI18N
    clickDelayLbl.setText(Bundle.getMessage("LabelClickDelay"));
    // NOI18N
    clickDelayLbl.setToolTipText(Bundle.getMessage("ToolTipClickDelay"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), clickDelayLbl, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    // NOI18N
    disallowedFramesLbl.setText(Bundle.getMessage("LabelDisallowedFrames"));
    // NOI18N
    disallowedFramesLbl.setToolTipText(Bundle.getMessage("ToolTipDisallowedFrames"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), disallowedFramesLbl, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    disallowedFrames.setModel(new DefaultEditableListModel<String>());
    disallowedFrames.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // NOI18N
    disallowedFrames.setToolTipText(Bundle.getMessage("ToolTipDisallowedFrames"));
    disallowedFrames.setListCellEditor(new DefaultListCellEditor<>(new JTextField()));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, enableFrames, ELProperty.create("${selected}"), disallowedFrames, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    DefaultEditableListModel<String> model = (DefaultEditableListModel<String>) this.disallowedFrames.getModel();
    model.addListDataListener(this);
    for (String frame : this.preferences.getDisallowedFrames()) {
        model.addElement(frame);
    }
    model.addElement(" ");
    jScrollPane1.setViewportView(disallowedFrames);
    GroupLayout enableFramesPnlLayout = new GroupLayout(enableFramesPnl);
    enableFramesPnl.setLayout(enableFramesPnlLayout);
    enableFramesPnlLayout.setHorizontalGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enableFramesPnlLayout.createSequentialGroup().addContainerGap().addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enableFramesPnlLayout.createSequentialGroup().addGap(29, 29, 29).addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enableFramesPnlLayout.createSequentialGroup().addComponent(clickDelay, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(clickDelayLbl, GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE)).addGroup(enableFramesPnlLayout.createSequentialGroup().addComponent(refreshDelay, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(refreshDelayLbl, GroupLayout.PREFERRED_SIZE, 104, GroupLayout.PREFERRED_SIZE)).addComponent(useAjax, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE).addComponent(disallowedFramesLbl, GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE))).addComponent(enableFrames, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()));
    enableFramesPnlLayout.setVerticalGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enableFramesPnlLayout.createSequentialGroup().addContainerGap().addComponent(enableFrames).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(clickDelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(clickDelayLbl).addComponent(disallowedFramesLbl)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enableFramesPnlLayout.createSequentialGroup().addGroup(enableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(refreshDelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(refreshDelayLbl)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(useAjax).addContainerGap(108, Short.MAX_VALUE)).addComponent(jScrollPane1))));
    // NOI18N
    disableFrames.setText(Bundle.getMessage("LabelDisableFrames"));
    // NOI18N
    disableFrames.setToolTipText(Bundle.getMessage("ToolTipDisableFrames"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${disableFrames}"), disableFrames, BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    // NOI18N
    redirectToPanels.setText(Bundle.getMessage("LabelRedirectFramesToPanels"));
    // NOI18N
    redirectToPanels.setToolTipText(Bundle.getMessage("ToolTipRedirectFramesToPanels"));
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, preferences, ELProperty.create("${redirectFramesToPanels}"), redirectToPanels, BeanProperty.create("selected"));
    bindingGroup.addBinding(binding);
    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, disableFrames, ELProperty.create("${selected}"), redirectToPanels, BeanProperty.create("enabled"));
    bindingGroup.addBinding(binding);
    GroupLayout disableFramesPnlLayout = new GroupLayout(disableFramesPnl);
    disableFramesPnl.setLayout(disableFramesPnlLayout);
    disableFramesPnlLayout.setHorizontalGroup(disableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(disableFramesPnlLayout.createSequentialGroup().addGroup(disableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(disableFramesPnlLayout.createSequentialGroup().addContainerGap().addComponent(disableFrames, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(disableFramesPnlLayout.createSequentialGroup().addGap(35, 35, 35).addComponent(redirectToPanels, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))).addContainerGap()));
    disableFramesPnlLayout.setVerticalGroup(disableFramesPnlLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(disableFramesPnlLayout.createSequentialGroup().addContainerGap().addComponent(disableFrames, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(redirectToPanels).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(enableFramesPnl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(disableFramesPnl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(enableFramesPnl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(disableFramesPnl, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
    bindingGroup.bind();
}
Also used : JScrollPane(javax.swing.JScrollPane) AutoBinding(org.jdesktop.beansbinding.AutoBinding) Binding(org.jdesktop.beansbinding.Binding) JPanel(javax.swing.JPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) DefaultEditableListModel(jmri.swing.DefaultEditableListModel) JRadioButton(javax.swing.JRadioButton) PropertyChangeListener(java.beans.PropertyChangeListener) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) ButtonGroup(javax.swing.ButtonGroup) BindingGroup(org.jdesktop.beansbinding.BindingGroup) GroupLayout(javax.swing.GroupLayout) JSpinner(javax.swing.JSpinner)

Example 49 with ButtonGroup

use of javax.swing.ButtonGroup in project JMRI by JMRI.

the class RosterFrame method bottomRight.

JPanel bottomRight() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    ButtonGroup progMode = new ButtonGroup();
    progMode.add(service);
    progMode.add(ops);
    progMode.add(edit);
    service.setEnabled(false);
    ops.setEnabled(false);
    edit.setEnabled(true);
    firePropertyChange("setprogservice", "setEnabled", false);
    firePropertyChange("setprogops", "setEnabled", false);
    firePropertyChange("setprogedit", "setEnabled", true);
    ops.setOpaque(false);
    service.setOpaque(false);
    edit.setOpaque(false);
    JPanel progModePanel = new JPanel();
    GridLayout buttonLayout = new GridLayout(3, 1, 0, 0);
    progModePanel.setLayout(buttonLayout);
    progModePanel.add(service);
    progModePanel.add(ops);
    progModePanel.add(edit);
    programModeListener = (ActionEvent e) -> {
        updateProgMode();
    };
    service.addActionListener(programModeListener);
    ops.addActionListener(programModeListener);
    edit.addActionListener(programModeListener);
    service.setVisible(false);
    ops.setVisible(false);
    panel.add(progModePanel);
    JPanel buttonHolder = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTH;
    c.gridx = 0;
    c.ipady = 20;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridy = 0;
    c.insets = new Insets(2, 2, 2, 2);
    buttonHolder.add(prog1Button, c);
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    c.ipady = 0;
    buttonHolder.add(rosterMedia, c);
    c.weightx = 1.0;
    c.fill = GridBagConstraints.NONE;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.ipady = 0;
    buttonHolder.add(throttleLaunch, c);
    //buttonHolder.add(throttleLaunch);
    panel.add(buttonHolder);
    prog1Button.setEnabled(false);
    prog1Button.addActionListener((ActionEvent e) -> {
        if (log.isDebugEnabled()) {
            log.debug("Open programmer pressed");
        }
        startProgrammer(null, re, programmer1);
    });
    /*
         * prog2Button.setEnabled(false); prog2Button.addActionListener( new
         * ActionListener() { public void
         * actionPerformed(java.awt.event.ActionEvent e) { if
         * (log.isDebugEnabled()) log.debug("Open progDebugger pressed");
         * startProgrammer(null, re, programmer2); } });
         */
    /*
         * throttleLabels.setEnabled(false); throttleLabels.addActionListener(
         * new ActionListener() { public void
         * actionPerformed(java.awt.event.ActionEvent e) { if
         * (log.isDebugEnabled()) log.debug("Open progDebugger pressed");
         * editMediaButton(); } });
         */
    rosterMedia.setEnabled(false);
    rosterMedia.addActionListener((ActionEvent e) -> {
        if (log.isDebugEnabled()) {
            log.debug("Open programmer pressed");
        }
        edit.setSelected(true);
        startProgrammer(null, re, "dp3" + File.separator + "MediaPane");
    });
    throttleLaunch.setEnabled(false);
    throttleLaunch.addActionListener((ActionEvent e) -> {
        if (log.isDebugEnabled()) {
            log.debug("Launch Throttle pressed");
        }
        if (!checkIfEntrySelected()) {
            return;
        }
        ThrottleFrame tf = ThrottleFrameManager.instance().createThrottleFrame();
        tf.toFront();
        tf.getAddressPanel().setRosterEntry(re);
    });
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) ThrottleFrame(jmri.jmrit.throttle.ThrottleFrame)

Example 50 with ButtonGroup

use of javax.swing.ButtonGroup in project JMRI by JMRI.

the class SimpleTurnoutStateEntry method createEntryPanel.

/**
     * Creates a GUI Panel for managing the address and position of a turnout, 
     * as used in configuring the turnout address of a DS64 output.
     *
     * @param label a text string to be displayed in the JPanel with the turnout 
     *              address and position 
     * @return a JPanel containing the label, the turnout address text field, and 
     *              position GUI elements
     */
public JPanel createEntryPanel(String label) {
    entryPanel = new JPanel();
    entryPanel.setLayout(new FlowLayout());
    entryPanel.add(new JLabel(label));
    entryPanel.add(addressField);
    JPanel p2 = new JPanel();
    p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS));
    ButtonGroup g = new ButtonGroup();
    if (addressField.getText().length() == 0) {
        closedRadioButton.setSelected(false);
        thrownRadioButton.setSelected(false);
        if (unusedRadioButton != null) {
            unusedRadioButton.setSelected(true);
        }
        addressField.setText("");
    } else if (Integer.parseInt(addressField.getText()) == 2048) {
        closedRadioButton.setSelected(false);
        thrownRadioButton.setSelected(false);
        if (unusedRadioButton != null) {
            unusedRadioButton.setSelected(true);
        }
        addressField.setText("");
    } else {
        if (unusedRadioButton != null) {
            unusedRadioButton.setSelected(false);
        }
        closedRadioButton.setSelected(getIsClosed());
        thrownRadioButton.setSelected(!getIsClosed());
    }
    g.add(thrownRadioButton);
    g.add(closedRadioButton);
    p2.add(thrownRadioButton);
    p2.add(closedRadioButton);
    if (unusedRadioButton != null) {
        g.add(unusedRadioButton);
        p2.add(unusedRadioButton);
    }
    entryPanel.add(p2);
    return entryPanel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ButtonGroup(javax.swing.ButtonGroup) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Aggregations

ButtonGroup (javax.swing.ButtonGroup)339 JPanel (javax.swing.JPanel)202 JRadioButton (javax.swing.JRadioButton)186 JLabel (javax.swing.JLabel)148 ActionEvent (java.awt.event.ActionEvent)134 ActionListener (java.awt.event.ActionListener)118 BoxLayout (javax.swing.BoxLayout)83 GridBagLayout (java.awt.GridBagLayout)81 JButton (javax.swing.JButton)75 JTextField (javax.swing.JTextField)70 JMenu (javax.swing.JMenu)69 GridBagConstraints (java.awt.GridBagConstraints)67 BorderLayout (java.awt.BorderLayout)64 Insets (java.awt.Insets)64 Dimension (java.awt.Dimension)58 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)57 FlowLayout (java.awt.FlowLayout)53 JMenuItem (javax.swing.JMenuItem)50 JCheckBox (javax.swing.JCheckBox)47 JScrollPane (javax.swing.JScrollPane)47