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;
}
Aggregations