use of com.mucommander.ui.text.RecordingKeyStrokeTextField in project mucommander by mucommander.
the class CommandBarDialog method createCommandBarPanel.
private JPanel createCommandBarPanel() {
YBoxPanel panel = new YBoxPanel();
panel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));
panel.add(Box.createRigidArea(new Dimension(0, 5)));
YBoxPanel listsPanel = new YBoxPanel();
listsPanel.add(commandBarButtonsList);
listsPanel.add(commandBarAlternateButtonsList);
JScrollPane scrollPane = new JScrollPane(listsPanel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setBorder(null);
panel.add(scrollPane);
panel.add(Box.createRigidArea(new Dimension(0, 5)));
panel.add(new JLabel("(" + Translator.get("command_bar_dialog.help") + ")"));
panel.add(Box.createRigidArea(new Dimension(0, 5)));
JPanel modifierPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
modifierField = new RecordingKeyStrokeTextField(MODIFIER_FIELD_MAX_LENGTH, CommandBarAttributes.getModifier()) {
@Override
public void setText(String t) {
super.setText(t);
componentChanged();
}
@Override
public void keyPressed(KeyEvent e) {
int pressedKeyCode = e.getKeyCode();
// Accept modifier keys only
if (pressedKeyCode == KeyEvent.VK_CONTROL || pressedKeyCode == KeyEvent.VK_ALT || pressedKeyCode == KeyEvent.VK_META || pressedKeyCode == KeyEvent.VK_SHIFT)
super.keyPressed(e);
}
};
modifierPanel.add(new JLabel(Translator.get("command_bar_customize_dialog.modifier")));
modifierPanel.add(modifierField);
panel.add(modifierPanel);
return panel;
}
Aggregations