Search in sources :

Example 81 with GridLayout

use of java.awt.GridLayout in project knime-core by knime.

the class NormalizerNodeDialog method generateContent.

/*
     * Generates the radio buttons and text fields
     */
private JPanel generateContent() {
    JPanel panel = new JPanel();
    // min-max
    JPanel panel1 = new JPanel();
    GridLayout gl = new GridLayout(2, 4);
    panel1.setLayout(gl);
    m_minmaxButton = new JRadioButton("Min-Max Normalization");
    m_minmaxButton.setSelected(true);
    JLabel nmin = new JLabel("Min: ");
    JPanel spanel1 = new JPanel();
    spanel1.setLayout(new BorderLayout());
    spanel1.add(nmin, BorderLayout.EAST);
    spanel1.setMaximumSize(new Dimension(30, 10));
    m_newminTextField = new JTextField(2);
    JLabel nmax = new JLabel("Max: ");
    JPanel spanel2 = new JPanel();
    spanel2.setLayout(new BorderLayout());
    spanel2.add(nmax, BorderLayout.EAST);
    spanel2.setMaximumSize(new Dimension(30, 10));
    m_newmaxTextField = new JTextField(2);
    panel1.add(m_minmaxButton);
    panel1.add(spanel1);
    panel1.add(m_newminTextField);
    panel1.add(Box.createHorizontalGlue());
    panel1.add(new JPanel());
    panel1.add(spanel2);
    panel1.add(m_newmaxTextField);
    panel1.add(Box.createHorizontalGlue());
    // z-score
    JPanel panel2 = new JPanel();
    panel2.setLayout(new BorderLayout());
    m_zscoreButton = new JRadioButton("Z-Score Normalization");
    panel2.add(m_zscoreButton, BorderLayout.WEST);
    // decimal scaling
    JPanel panel3 = new JPanel();
    panel3.setLayout(new BorderLayout());
    m_decButton = new JRadioButton("Normalization by Decimal Scaling");
    panel3.add(m_decButton, BorderLayout.WEST);
    // Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(m_minmaxButton);
    group.add(m_zscoreButton);
    group.add(m_decButton);
    m_minmaxButton.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_minmaxButton.isSelected()) {
                m_filterpanel.setEnabled(true);
                m_newminTextField.setEnabled(true);
                m_newmaxTextField.setEnabled(true);
            }
        }
    });
    m_zscoreButton.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_zscoreButton.isSelected()) {
                m_filterpanel.setEnabled(true);
                m_newminTextField.setEnabled(false);
                m_newmaxTextField.setEnabled(false);
            }
        }
    });
    m_decButton.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_decButton.isSelected()) {
                m_filterpanel.setEnabled(true);
                m_newminTextField.setEnabled(false);
                m_newmaxTextField.setEnabled(false);
            }
        }
    });
    BoxLayout bly = new BoxLayout(panel, BoxLayout.Y_AXIS);
    panel.setLayout(bly);
    panel.add(panel1);
    panel.add(panel2);
    panel.add(panel3);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) ItemListener(java.awt.event.ItemListener) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField)

Example 82 with GridLayout

use of java.awt.GridLayout in project knime-core by knime.

the class EditNumericDomainNodeDialogPane method createMinMaxTab.

private void createMinMaxTab() {
    m_filterPanel = new DataColumnSpecFilterPanel();
    m_filterPanel.setIncludeTitle(" Include ");
    m_filterPanel.setExcludeTitle(" Exclude ");
    m_lowerBField = createTextField("0.0");
    m_upperBField = createTextField("1.0");
    JPanel retainMinMaxPanel = new JPanel(new GridLayout(2, 2));
    retainMinMaxPanel.setBorder(BorderFactory.createTitledBorder("Domain"));
    createBoundedBox(retainMinMaxPanel, m_lowerBField, LOWER_B + ": ");
    createBoundedBox(retainMinMaxPanel, m_upperBField, UPPER_B + ": ");
    Box outOfDomainBox = Box.createVerticalBox();
    outOfDomainBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Out of Domain Policy"));
    m_buttonGrp = new ButtonGroup();
    for (final DomainOverflowPolicy handler : DomainOverflowPolicy.values()) {
        JRadioButton jRadioButton = new JRadioButton(handler.getDescription());
        jRadioButton.setActionCommand(handler.toString());
        jRadioButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(final ActionEvent e) {
                m_handler = handler;
            }
        });
        m_buttonGrp.add(jRadioButton);
        outOfDomainBox.add(jRadioButton, Component.LEFT_ALIGNMENT);
    }
    JPanel tabpanel = new JPanel();
    tabpanel.setLayout(new BorderLayout());
    tabpanel.add(m_filterPanel, BorderLayout.NORTH);
    tabpanel.add(retainMinMaxPanel, BorderLayout.WEST);
    outOfDomainBox.add(Box.createHorizontalGlue());
    tabpanel.add(outOfDomainBox, BorderLayout.SOUTH);
    addTab("Edit Domain", tabpanel);
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JRadioButton(javax.swing.JRadioButton) DataColumnSpecFilterPanel(org.knime.core.node.util.filter.column.DataColumnSpecFilterPanel) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) ActionEvent(java.awt.event.ActionEvent) Box(javax.swing.Box) DomainOverflowPolicy(org.knime.base.node.preproc.domain.editnumeric.EditNumericDomainNodeModel.DomainOverflowPolicy)

Example 83 with GridLayout

use of java.awt.GridLayout in project knime-core by knime.

the class ColumnHandlingFactorySelectionPanel method createWarningLabel.

private static Component createWarningLabel(final List<String> warningMessages) {
    JPanel thin = new JPanel(new GridLayout(warningMessages.size(), 1));
    for (int i = 0; i < warningMessages.size(); i++) {
        String message = warningMessages.get(i);
        thin.add(new JLabel(message));
    }
    return thin;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JLabel(javax.swing.JLabel)

Example 84 with GridLayout

use of java.awt.GridLayout in project knime-core by knime.

the class ConstantValueColumnNodeDialogPane method verticalFlow.

/**
 * @return
 */
private JPanel verticalFlow(final JComponent... components) {
    JPanel nochPanel = new JPanel(new BorderLayout());
    nochPanel.setLayout(new GridLayout(components.length, 0, HORIZONTAL_VERTICAL_GAB, HORIZONTAL_VERTICAL_GAB));
    for (JComponent component : components) {
        nochPanel.add(component);
    }
    return nochPanel;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) JComponent(javax.swing.JComponent)

Example 85 with GridLayout

use of java.awt.GridLayout in project knime-core by knime.

the class FileReaderNodeDialog method createSettingsPanel.

private JPanel createSettingsPanel() {
    JButton advanced = new JButton("Advanced...");
    int buttonHeight = advanced.getPreferredSize().height;
    m_hasRowHeaders = new JCheckBox("read row IDs");
    m_hasRowHeaders.setToolTipText("Check if the file contains row IDs" + " in the first column");
    m_hasColHeaders = new JCheckBox("read column headers");
    m_hasColHeaders.setToolTipText("Check if the file contains column" + " headers in the first line");
    JLabel deliLabel = new JLabel("Column delimiter:");
    m_delimField = new JComboBox();
    m_delimField.setMaximumSize(new Dimension(70, buttonHeight));
    m_delimField.setMinimumSize(new Dimension(70, buttonHeight));
    m_delimField.setPreferredSize(new Dimension(70, buttonHeight));
    m_delimField.setEditable(true);
    Delimiter[] selDelims = DEFAULT_DELIMS;
    m_delimField.setModel(new DefaultComboBoxModel(selDelims));
    deliLabel.setToolTipText("Specify the data delimiter character(s)");
    m_delimField.setToolTipText("Specify the data delimiter character(s)");
    m_cStyleComment = new JCheckBox("Java-style comments");
    m_cStyleComment.setToolTipText("Check to add support for '//' and " + "\"'/*' and '*/'\" comment");
    m_singleLineComment = new JTextField(2);
    m_singleLineComment.setMaximumSize(new Dimension(55, buttonHeight));
    m_singleLineComment.setMinimumSize(new Dimension(55, buttonHeight));
    m_singleLineComment.setPreferredSize(new Dimension(55, buttonHeight));
    JLabel commentLabel = new JLabel("Single line comment:");
    m_ignoreWS = new JCheckBox("ignore spaces and tabs");
    m_ignoreWS.setToolTipText("If checked, whitespaces (spaces and tabs)" + " will be discarded (if not quoted)");
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(3, 3));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Basic Settings"));
    // top row
    Box rowBox = Box.createHorizontalBox();
    rowBox.add(m_hasRowHeaders);
    rowBox.add(Box.createGlue());
    Box delimBox = Box.createHorizontalBox();
    delimBox.add(Box.createHorizontalStrut(4));
    delimBox.add(deliLabel);
    delimBox.add(Box.createHorizontalStrut(3));
    delimBox.add(m_delimField);
    delimBox.add(Box.createGlue());
    Box advBox = Box.createHorizontalBox();
    advBox.add(Box.createGlue());
    advBox.add(advanced);
    advBox.add(Box.createGlue());
    // middle row
    Box colBox = Box.createHorizontalBox();
    colBox.add(m_hasColHeaders);
    colBox.add(Box.createGlue());
    Box wsBox = Box.createHorizontalBox();
    wsBox.add(m_ignoreWS);
    wsBox.add(Box.createGlue());
    // bottom row
    Box pValBox = Box.createHorizontalBox();
    // placeholder
    pValBox.add(new JLabel(""));
    pValBox.add(Box.createGlue());
    Box cCmtBox = Box.createHorizontalBox();
    cCmtBox.add(m_cStyleComment);
    cCmtBox.add(Box.createGlue());
    Box slcBox = Box.createHorizontalBox();
    slcBox.add(commentLabel);
    slcBox.add(Box.createHorizontalStrut(3));
    slcBox.add(m_singleLineComment);
    slcBox.add(Box.createGlue());
    // now fill the grid: first row
    panel.add(rowBox);
    panel.add(delimBox);
    panel.add(advBox);
    // second row
    panel.add(colBox);
    panel.add(wsBox);
    panel.add(new JLabel(""));
    // third row
    panel.add(pValBox);
    panel.add(cCmtBox);
    panel.add(slcBox);
    int componentsHeight = (2 * COMP_HEIGHT) + 30 + buttonHeight;
    panel.setMaximumSize(new Dimension(PANEL_WIDTH, componentsHeight));
    advanced.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            advancedSettings();
        }
    });
    m_hasRowHeaders.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            rowHeadersSettingsChanged();
        }
    });
    m_hasColHeaders.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            colHeadersSettingsChanged();
        }
    });
    m_cStyleComment.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            commentSettingsChanged();
        }
    });
    m_delimField.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            delimSettingsChanged();
        }
    });
    m_ignoreWS.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            ignoreWSChanged();
        }
    });
    m_singleLineComment.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void changedUpdate(final DocumentEvent e) {
            commentSettingsChanged();
        }

        @Override
        public void insertUpdate(final DocumentEvent e) {
            commentSettingsChanged();
        }

        @Override
        public void removeUpdate(final DocumentEvent e) {
            commentSettingsChanged();
        }
    });
    // add a panel for the errors:
    m_errorLabel = new JLabel("");
    m_errorLabel.setForeground(Color.red);
    m_errorDetail = new JLabel("");
    m_errorDetail.setForeground(Color.red);
    JPanel errorBox = new JPanel();
    errorBox.setLayout(new BoxLayout(errorBox, BoxLayout.X_AXIS));
    errorBox.add(Box.createHorizontalGlue());
    errorBox.add(m_errorLabel);
    // reserve a certain height for the (in the beginning invisible) label
    errorBox.add(Box.createVerticalStrut(17));
    errorBox.add(Box.createHorizontalGlue());
    JPanel detailBox = new JPanel();
    detailBox.setLayout(new BoxLayout(detailBox, BoxLayout.X_AXIS));
    detailBox.add(Box.createHorizontalGlue());
    detailBox.add(m_errorDetail);
    // reserve a certain height for the (in the beginning invisible) label
    detailBox.add(Box.createVerticalStrut(17));
    detailBox.add(Box.createHorizontalGlue());
    JPanel result = new JPanel();
    result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));
    result.add(panel);
    result.add(errorBox);
    result.add(detailBox);
    return result;
}
Also used : JPanel(javax.swing.JPanel) DocumentListener(javax.swing.event.DocumentListener) ItemEvent(java.awt.event.ItemEvent) JComboBox(javax.swing.JComboBox) Delimiter(org.knime.core.util.tokenizer.Delimiter) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) JTextField(javax.swing.JTextField) DocumentEvent(javax.swing.event.DocumentEvent) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) ActionListener(java.awt.event.ActionListener) ItemListener(java.awt.event.ItemListener)

Aggregations

GridLayout (java.awt.GridLayout)189 JPanel (javax.swing.JPanel)149 JLabel (javax.swing.JLabel)79 BorderLayout (java.awt.BorderLayout)67 Dimension (java.awt.Dimension)51 JButton (javax.swing.JButton)41 ActionEvent (java.awt.event.ActionEvent)36 JScrollPane (javax.swing.JScrollPane)34 ActionListener (java.awt.event.ActionListener)32 Insets (java.awt.Insets)28 JCheckBox (javax.swing.JCheckBox)28 JTextField (javax.swing.JTextField)28 GridBagConstraints (java.awt.GridBagConstraints)24 GridBagLayout (java.awt.GridBagLayout)23 ButtonGroup (javax.swing.ButtonGroup)22 FlowLayout (java.awt.FlowLayout)21 BoxLayout (javax.swing.BoxLayout)21 TitledBorder (javax.swing.border.TitledBorder)19 PlotCanvas (smile.plot.PlotCanvas)16 EmptyBorder (javax.swing.border.EmptyBorder)15