init();
}
@Override
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
// Hide Window on ESC
Action escapeAction = new AbstractAction("ESCAPE") { //$NON-NLS-1$
/**
*
*/
private static final long serialVersionUID = -6543764044868772971L;
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
// Do search on Enter
Action enterAction = new AbstractAction("ENTER") { //$NON-NLS-1$
private static final long serialVersionUID = -3661361497864527363L;
@Override
public void actionPerformed(final ActionEvent actionEvent) {
checkDirtyAndLoad(actionEvent);
}
};
ActionMap actionMap = rootPane.getActionMap();
actionMap.put(escapeAction.getValue(Action.NAME), escapeAction);
actionMap.put(enterAction.getValue(Action.NAME), enterAction);
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
inputMap.put(KeyStrokes.ENTER, enterAction.getValue(Action.NAME));
return rootPane;
}