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