Search in sources :

Example 71 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class SleepNodeDialog method waitToTimePanel.

private void waitToTimePanel() {
    m_waitToSpinnerModel = new SpinnerDateModel();
    m_toSpinner = new JSpinner(m_waitToSpinnerModel);
    m_toSpinner.setEditor(new JSpinner.DateEditor(m_toSpinner, "HH:mm:ss"));
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    m_waitToSpinnerModel.setValue(cal.getTime());
    m_toRB = new JRadioButton("Wait to time:");
    m_toRB.doClick();
    m_toRB.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_toRB.isSelected()) {
                m_selection = 1;
            }
            m_toSpinner.setEnabled(m_toRB.isSelected());
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) Calendar(java.util.Calendar) JSpinner(javax.swing.JSpinner) ItemListener(java.awt.event.ItemListener) SpinnerDateModel(javax.swing.SpinnerDateModel)

Example 72 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class NameFilterPanel method createButtonToFilterPanel.

/**
 * Creates a JRadioButton to the given FilterTypePanel.
 *
 * The created button will be initialized with the correct description, and action listener.
 *
 * @param actionCommand The action command that identifies the type that this button belongs to
 * @param label The label of this button that is shown to the user
 * @return The JRadioButton
 * @since 2.9
 */
protected JRadioButton createButtonToFilterPanel(final String actionCommand, final String label) {
    JRadioButton button = new JRadioButton(label);
    button.setActionCommand(actionCommand);
    button.addActionListener(e -> {
        if (e.getActionCommand() != null) {
            String oldType = m_currentType;
            m_currentType = e.getActionCommand();
            if (!m_currentType.equals(oldType)) {
                fireFilteringChangedEvent();
            }
            updateFilterPanel();
        }
    });
    return button;
}
Also used : JRadioButton(javax.swing.JRadioButton)

Example 73 with JRadioButton

use of javax.swing.JRadioButton in project vcell by virtualcell.

the class PDEDataViewer method sendTimeSeriesImageJ.

// private Hashtable<String, JLabel> sendTimeSeriesLabels = new Hashtable<>();
// @Override
// public void exportMessage(ExportEvent event) {
// super.exportMessage(event);
// if(sendTimeSeriesLabels.size() > 0){
// JLabel messgLabel = sendTimeSeriesLabels.values().iterator().next();
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
// messgLabel.setText(event.getMessageData().toString());
// }
// });
// }
// }
private void sendTimeSeriesImageJ() {
    final JPanel mainJPanel = new JPanel();
    BoxLayout mainBL = new BoxLayout(mainJPanel, BoxLayout.Y_AXIS);
    mainJPanel.setLayout(mainBL);
    final boolean[] response = new boolean[] { false };
    MiniTimePanel timeJPanel = new MiniTimePanel();
    final JLabel messgLabel = new JLabel("time points to export:" + (timeJPanel.jcb_time_end.getSelectedIndex() - timeJPanel.jcb_time_begin.getSelectedIndex() + 1));
    JRadioButton slicebtn = new JRadioButton("Slice " + getPDEDataContextPanel1().getSlice() + " only");
    slicebtn.setSelected(true);
    JPanel messageAndSlicePanel = null;
    if (getPdeDataContext().getCartesianMesh().getGeometryDimension() == 3) {
        messageAndSlicePanel = new JPanel();
        ((FlowLayout) messageAndSlicePanel.getLayout()).setAlignment(FlowLayout.LEFT);
        ButtonGroup buttonGroup = new ButtonGroup();
        JRadioButton allslicebtn = new JRadioButton("All slices");
        buttonGroup.add(slicebtn);
        buttonGroup.add(allslicebtn);
        messageAndSlicePanel.add(messgLabel);
        messageAndSlicePanel.add(slicebtn);
        messageAndSlicePanel.add(allslicebtn);
    }
    ActionListener okAction = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (((Double) timeJPanel.jcb_time_begin.getSelectedItem()).compareTo((Double) timeJPanel.jcb_time_end.getSelectedItem()) > 0) {
                PopupGenerator.showErrorDialog(PDEDataViewer.this, "Selected 'Begin Time' must be less than or equal to 'End Time'");
                return;
            }
            response[0] = true;
            BeanUtils.disposeParentWindow(mainJPanel);
        }
    };
    ActionListener cancelAction = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            BeanUtils.disposeParentWindow(mainJPanel);
        }
    };
    final OkCancelSubPanel okCancelJPanel = new OkCancelSubPanel(okAction, cancelAction);
    ActionListener rangeListener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int range = timeJPanel.jcb_time_end.getSelectedIndex() - timeJPanel.jcb_time_begin.getSelectedIndex() + 1;
            okCancelJPanel.okButton.setEnabled(range > 0);
            messgLabel.setText((range < 0 ? "Error: begin time must be < end time" : "time points to export:" + (range)));
        }
    };
    timeJPanel.jcb_time_end.addActionListener(rangeListener);
    timeJPanel.jcb_time_begin.addActionListener(rangeListener);
    okCancelJPanel.okButton.setEnabled(true);
    mainJPanel.add(timeJPanel);
    mainJPanel.add((messageAndSlicePanel == null ? messgLabel : messageAndSlicePanel));
    mainJPanel.add(okCancelJPanel);
    Frame dialogOwner = JOptionPane.getFrameForComponent(this);
    JOptionPane inputDialog = new JOptionPane(mainJPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[0]);
    final JDialog d = inputDialog.createDialog(dialogOwner, "'" + getSimulationModelInfo().getContextName() + "':'" + getSimulationModelInfo().getSimulationName() + "':'" + getPdeDataContext().getVariableName() + "'");
    d.setResizable(true);
    d.setModal(true);
    d.pack();
    d.setVisible(true);
    // }
    if (!response[0]) {
        return;
    }
    ExportSpecs exportSpecs = new ExportSpecs(getPdeDataContext().getVCDataIdentifier(), ExportFormat.IMAGEJ, new VariableSpecs(new String[] { getPdeDataContext().getDataIdentifier().getName() }, ExportConstants.VARIABLE_MULTI), new TimeSpecs(timeJPanel.jcb_time_begin.getSelectedIndex(), timeJPanel.jcb_time_end.getSelectedIndex(), getPdeDataContext().getTimePoints(), ExportConstants.TIME_RANGE), new GeometrySpecs(null, getPDEDataContextPanel1().getNormalAxis(), getPDEDataContextPanel1().getSlice(), (slicebtn.isSelected() ? ExportConstants.GEOMETRY_SLICE : ExportConstants.GEOMETRY_FULL)), new RasterSpecs(ExportConstants.NRRD_BY_VARIABLE, false), getSimulationModelInfo().getSimulationName(), getSimulationModelInfo().getContextName());
    getDataViewerManager().startExport(this, ((ClientPDEDataContext) getPdeDataContext()).getDataManager().getOutputContext(), exportSpecs);
}
Also used : JPanel(javax.swing.JPanel) Frame(java.awt.Frame) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) RasterSpecs(cbit.vcell.export.server.RasterSpecs) ActionEvent(java.awt.event.ActionEvent) ExportSpecs(cbit.vcell.export.server.ExportSpecs) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) GeometrySpecs(cbit.vcell.export.server.GeometrySpecs) JOptionPane(javax.swing.JOptionPane) Point(java.awt.Point) SinglePoint(cbit.vcell.geometry.SinglePoint) VariableSpecs(cbit.vcell.export.server.VariableSpecs) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) ClientPDEDataContext(cbit.vcell.simdata.ClientPDEDataContext) TimeSpecs(cbit.vcell.export.server.TimeSpecs) JDialog(javax.swing.JDialog)

Example 74 with JRadioButton

use of javax.swing.JRadioButton in project vcell by virtualcell.

the class PDEExportDataPanel method getBothVarRadioButton.

/**
 * @return
 */
protected JRadioButton getBothVarRadioButton() {
    if (bothVarRadioButton == null) {
        bothVarRadioButton = new JRadioButton();
        bothVarRadioButton.setText("Vol/Membr Data");
    }
    return bothVarRadioButton;
}
Also used : JRadioButton(javax.swing.JRadioButton)

Example 75 with JRadioButton

use of javax.swing.JRadioButton in project vcell by virtualcell.

the class AnalysisResultsTablePanel method getConfidenceButtonPanel.

private JPanel getConfidenceButtonPanel() {
    if (confidenceButtonPanel == null) {
        confidenceButtonPanel = new JPanel();
        confidence80RadioButton = new JRadioButton("80% Confidence Level     ", true);
        confidence80RadioButton.addActionListener(this);
        confidence90RadioButton = new JRadioButton("90% Confidence Level     ");
        confidence90RadioButton.addActionListener(this);
        confidence95RadioButton = new JRadioButton("95% Confidence Level     ");
        confidence95RadioButton.addActionListener(this);
        confidence99RadioButton = new JRadioButton("99% Confidence Level     ");
        confidence99RadioButton.addActionListener(this);
        ButtonGroup bg = new ButtonGroup();
        bg.add(confidence80RadioButton);
        bg.add(confidence90RadioButton);
        bg.add(confidence95RadioButton);
        bg.add(confidence99RadioButton);
        confidenceButtonPanel.add(confidence80RadioButton);
        confidenceButtonPanel.add(confidence90RadioButton);
        confidenceButtonPanel.add(confidence95RadioButton);
        confidenceButtonPanel.add(confidence99RadioButton);
    }
    return confidenceButtonPanel;
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup)

Aggregations

JRadioButton (javax.swing.JRadioButton)323 ButtonGroup (javax.swing.ButtonGroup)185 JPanel (javax.swing.JPanel)168 JLabel (javax.swing.JLabel)144 ActionEvent (java.awt.event.ActionEvent)104 ActionListener (java.awt.event.ActionListener)95 JTextField (javax.swing.JTextField)81 JButton (javax.swing.JButton)77 BoxLayout (javax.swing.BoxLayout)61 JCheckBox (javax.swing.JCheckBox)59 GridBagLayout (java.awt.GridBagLayout)57 BorderLayout (java.awt.BorderLayout)52 GridBagConstraints (java.awt.GridBagConstraints)52 Insets (java.awt.Insets)51 Dimension (java.awt.Dimension)45 FlowLayout (java.awt.FlowLayout)42 JScrollPane (javax.swing.JScrollPane)41 GridLayout (java.awt.GridLayout)32 JComboBox (javax.swing.JComboBox)32 ItemEvent (java.awt.event.ItemEvent)25