use of javax.swing.JRootPane in project jmeter by apache.
the class EscapeDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
Action escapeAction = new AbstractAction("ESCAPE") {
/**
*/
private static final long serialVersionUID = 2208129319916921772L;
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
};
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
rootPane.getActionMap().put(escapeAction.getValue(Action.NAME), escapeAction);
return rootPane;
}
use of javax.swing.JRootPane in project jmeter by apache.
the class RecorderDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
// Hide Window on ESC
Action escapeAction = new AbstractAction("ESCAPE") {
private static final long serialVersionUID = -6543764044868772971L;
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
ActionMap actionMap = rootPane.getActionMap();
actionMap.put(escapeAction.getValue(Action.NAME), escapeAction);
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
return rootPane;
}
use of javax.swing.JRootPane in project jmeter by apache.
the class FunctionHelper method createRootPane.
/**
* Allow Dialog to be closed by ESC key
*/
@Override
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
javax.swing.Action escapeAction = new AbstractAction("ESCAPE") {
private static final long serialVersionUID = -4036804004190858925L;
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
rootPane.getActionMap().put(escapeAction.getValue(Action.NAME), escapeAction);
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
return rootPane;
}
use of javax.swing.JRootPane in project opennars by opennars.
the class DockingRegionContainer method showDragControl.
void showDragControl() {
// System.err.println("showDragControl()");
JRootPane rootPane = getRootPane();
oldGlass = (JComponent) rootPane.getGlassPane();
// overlayPanel = new DraggingOverlayPanel(this);
rootPane.setGlassPane(overlayPanel);
overlayPanel.setVisible(true);
rootPane.revalidate();
rootPane.repaint();
}
use of javax.swing.JRootPane in project ChatGameFontificator by GlitchCog.
the class ChatWindow method setupHideOnEscape.
/**
* Does the work required to make the parameter JDialog be hidden when pressing escape
*
* @param popup
*/
public static void setupHideOnEscape(final JDialog popup) {
Action aa = new AbstractAction() {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent event) {
popup.setVisible(false);
}
};
final String mapKey = "escapePressed";
JRootPane root = popup.getRootPane();
root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeStroke, mapKey);
root.getActionMap().put(mapKey, aa);
}
Aggregations