use of javax.swing.KeyStroke in project gitblit by gitblit.
the class EditRegistrationDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
JRootPane rootPane = new JRootPane();
rootPane.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
return rootPane;
}
use of javax.swing.KeyStroke in project gitblit by gitblit.
the class RegistrationsDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
JRootPane rootPane = new JRootPane();
rootPane.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
return rootPane;
}
use of javax.swing.KeyStroke in project groovy-core by groovy.
the class GroovyFilter method installAutoTabAction.
public static void installAutoTabAction(JTextComponent tComp) {
tComp.getActionMap().put("GroovyFilter-autoTab", AUTO_TAB_ACTION);
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
tComp.getInputMap().put(keyStroke, "GroovyFilter-autoTab");
}
use of javax.swing.KeyStroke in project javatari by ppeccin.
the class JComboBoxNim method setEscActionListener.
private void setEscActionListener() {
KeyStroke escKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
Action escapeAction = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
closeAction();
}
private static final long serialVersionUID = 1L;
};
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escKeyStroke, "ESC");
getRootPane().getActionMap().put("ESC", escapeAction);
}
use of javax.swing.KeyStroke in project zaproxy by zaproxy.
the class DialogModifyCustomPage method init.
@Override
protected void init() {
if (this.workingContext == null) {
throw new IllegalStateException("A working Context should be set before setting the 'Add Dialog' visible.");
}
LOGGER.debug("Initializing modify Custom Page dialog for: {}", customPage);
// Handle escape key to close the dialog
KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
AbstractAction escapeAction = new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
DialogModifyCustomPage.this.setVisible(false);
DialogModifyCustomPage.this.dispose();
}
};
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
getRootPane().getActionMap().put("ESCAPE", escapeAction);
getEnabledCheckBox().setSelected(customPage.isEnabled());
getPageMatcherTextField().setText(customPage.getPageMatcher());
getCustomPagePageMatcherLocationsCombo().setSelectedItem(customPage.getPageMatcherLocation());
getRegexCheckBox().setSelected(customPage.isRegex());
getCustomPageTypesCombo().setSelectedItem(customPage.getType());
this.setConfirmButtonEnabled(true);
this.pack();
}
Aggregations