Search in sources :

Example 81 with FocusEvent

use of java.awt.event.FocusEvent in project knime-core by knime.

the class VariableFileReaderNodeDialog method createFileNamePanel.

private JPanel createFileNamePanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Select variable holding file location: (press 'Enter' to " + "update preview)"));
    Box fileBox = Box.createHorizontalBox();
    // Creating the brows button here in order to get its preferred height
    int buttonHeight = 20;
    m_urlCombo = new JComboBox();
    m_urlCombo.setEditable(false);
    m_urlCombo.setRenderer(new FlowVariableListCellRenderer());
    m_urlCombo.setMaximumSize(new Dimension(PANEL_WIDTH, buttonHeight));
    m_urlCombo.setMinimumSize(new Dimension(350, buttonHeight));
    m_urlCombo.setPreferredSize(new Dimension(350, buttonHeight));
    fileBox.add(Box.createHorizontalGlue());
    fileBox.add(new JLabel("Flow Variable Name:"));
    fileBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
    fileBox.add(m_urlCombo);
    fileBox.add(Box.createVerticalStrut(50));
    fileBox.add(Box.createHorizontalGlue());
    // the checkbox for preserving the current settings on file change
    Box preserveBox = Box.createHorizontalBox();
    m_preserveSettings = new JCheckBox("Preserve user settings for new location");
    m_preserveSettings.setToolTipText("if not checked, the settings you" + " have set are reset, if a new location is entered");
    m_preserveSettings.setSelected(false);
    m_preserveSettings.setEnabled(true);
    preserveBox.add(Box.createHorizontalGlue());
    preserveBox.add(m_preserveSettings);
    preserveBox.add(Box.createHorizontalGlue());
    panel.add(fileBox);
    panel.add(preserveBox);
    panel.setMaximumSize(new Dimension(PANEL_WIDTH, 70));
    panel.setMinimumSize(new Dimension(PANEL_WIDTH, 70));
    m_urlCombo.addItemListener(this);
    /* install action listeners */
    // set stuff to update preview when file location changes
    m_urlCombo.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            fileLocationChanged();
        }
    });
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) FlowVariableListCellRenderer(org.knime.core.node.util.FlowVariableListCellRenderer) FocusAdapter(java.awt.event.FocusAdapter) JComboBox(javax.swing.JComboBox) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) FocusEvent(java.awt.event.FocusEvent)

Aggregations

FocusEvent (java.awt.event.FocusEvent)81 FocusListener (java.awt.event.FocusListener)38 FocusAdapter (java.awt.event.FocusAdapter)33 JLabel (javax.swing.JLabel)21 ActionEvent (java.awt.event.ActionEvent)18 ActionListener (java.awt.event.ActionListener)17 JPanel (javax.swing.JPanel)15 JTextField (javax.swing.JTextField)15 Dimension (java.awt.Dimension)14 JButton (javax.swing.JButton)10 KeyEvent (java.awt.event.KeyEvent)9 JCheckBox (javax.swing.JCheckBox)9 BoxLayout (javax.swing.BoxLayout)8 JComboBox (javax.swing.JComboBox)8 Border (javax.swing.border.Border)8 Component (java.awt.Component)7 GridBagConstraints (java.awt.GridBagConstraints)6 GridBagLayout (java.awt.GridBagLayout)6 Insets (java.awt.Insets)6 MouseEvent (java.awt.event.MouseEvent)6