use of java.awt.event.KeyAdapter in project JMRI by JMRI.
the class ProfileManagerDialog 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() {
listLabel = new JLabel();
jScrollPane1 = new JScrollPane();
profiles = new JList<>();
btnSelect = new JButton();
btnCreate = new JButton();
btnUseExisting = new JButton();
countDownLbl = new JLabel();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
// NOI18N
setTitle(Bundle.getMessage("ProfileManagerDialog.title"));
setMinimumSize(new Dimension(310, 110));
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
formMousePressed(evt);
}
});
addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent evt) {
formWindowOpened(evt);
}
public void windowClosing(WindowEvent evt) {
formWindowClosing(evt);
}
});
// NOI18N
listLabel.setText(Bundle.getMessage("ProfileManagerDialog.listLabel.text"));
profiles.setModel(new ProfileListModel());
profiles.setSelectedValue(ProfileManager.getDefault().getActiveProfile(), true);
profiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// NOI18N
profiles.setToolTipText(Bundle.getMessage("ProfileManagerDialog.profiles.toolTipText"));
profiles.setCellRenderer(new ProfileListCellRenderer());
profiles.setNextFocusableComponent(btnSelect);
profiles.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
profilesKeyPressed(evt);
}
});
profiles.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
profilesValueChanged(evt);
}
});
jScrollPane1.setViewportView(profiles);
profiles.ensureIndexIsVisible(profiles.getSelectedIndex());
// NOI18N
profiles.getAccessibleContext().setAccessibleName(Bundle.getMessage("ProfileManagerDialog.profiles.AccessibleContext.accessibleName"));
// NOI18N
btnSelect.setText(Bundle.getMessage("ProfileManagerDialog.btnSelect.text"));
btnSelect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnSelectActionPerformed(evt);
}
});
// NOI18N
btnCreate.setText(Bundle.getMessage("ProfileManagerDialog.btnCreate.text"));
// NOI18N
btnCreate.setToolTipText(Bundle.getMessage("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
btnCreate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnCreateActionPerformed(evt);
}
});
// NOI18N
btnUseExisting.setText(Bundle.getMessage("ProfileManagerDialog.btnUseExisting.text"));
btnUseExisting.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnUseExistingActionPerformed(evt);
}
});
// NOI18N
countDownLbl.setText(Bundle.getMessage("ProfileManagerDialog.countDownLbl.text"));
// NOI18N
countDownLbl.setToolTipText(Bundle.getMessage("ProfileManagerDialog.countDownLbl.toolTipText"));
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(listLabel).addComponent(countDownLbl)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(btnUseExisting).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreate).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnSelect)).addComponent(jScrollPane1)).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE).addComponent(listLabel)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnSelect).addComponent(btnCreate).addComponent(btnUseExisting).addComponent(countDownLbl)).addContainerGap()));
// NOI18N
listLabel.getAccessibleContext().setAccessibleName(Bundle.getMessage("ProfileManagerDialog.listLabel.text"));
pack();
}
use of java.awt.event.KeyAdapter in project cayenne by apache.
the class PathChooserComboBoxCellEditor method initializeCombo.
protected void initializeCombo(CayenneTableModel model, int row, final JTable table) {
Object currentNode = getCurrentNodeToInitializeCombo(model, row);
String dbAttributePath = getPathToInitializeCombo(model, row);
List<String> nodeChildren = getChildren(currentNode, dbAttributePath);
this.table = table;
comboBoxPathChooser = Application.getWidgetFactory().createComboBox(nodeChildren, false);
comboBoxPathChooser.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.VK_ENTER) {
enterPressed(table);
return;
}
parsePathString(event.getKeyChar());
}
});
AutoCompletion.enable(comboBoxPathChooser, true, true);
((JComponent) comboBoxPathChooser.getEditor().getEditorComponent()).setBorder(null);
comboBoxPathChooser.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
comboBoxPathChooser.setRenderer(new PathChooserComboBoxCellRenderer());
comboBoxPathChooser.addActionListener(this);
comboBoxPathChooser.addPopupMenuListener(this);
}
Aggregations