use of javax.swing.JRootPane in project Course_Generator by patrovite.
the class FrmConfigMrbDuplicate method createRootPane.
/**
* Manage low level key strokes ESCAPE : Close the window
*
* @return
*/
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
Action actionListener = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
Action actionListenerEnter = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
RequestToClose();
}
};
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(strokeEscape, "ESCAPE");
rootPane.getActionMap().put("ESCAPE", actionListener);
inputMap.put(strokeEnter, "ENTER");
rootPane.getActionMap().put("ENTER", actionListenerEnter);
return rootPane;
}
use of javax.swing.JRootPane in project Course_Generator by patrovite.
the class frmImportPoints method createRootPane.
/**
* Manage low level key strokes ESCAPE : Close the window
*
* @return
*/
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
KeyStroke strokeEscape = KeyStroke.getKeyStroke("ESCAPE");
KeyStroke strokeEnter = KeyStroke.getKeyStroke("ENTER");
Action actionListener = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
Action actionListenerEnter = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
RequestToClose();
}
};
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(strokeEscape, "ESCAPE");
rootPane.getActionMap().put("ESCAPE", actionListener);
inputMap.put(strokeEnter, "ENTER");
rootPane.getActionMap().put("ENTER", actionListenerEnter);
return rootPane;
}
use of javax.swing.JRootPane in project LAN-Messenger by harshitbudhraja.
the class ServerMessaging method messagefieldFocusGained.
// GEN-LAST:event_sendbuttonActionPerformed
private void messagefieldFocusGained(java.awt.event.FocusEvent evt) {
// GEN-FIRST:event_messagefieldFocusGained
// TODO add your handling code here:
JRootPane rootPane = SwingUtilities.getRootPane(sendbutton);
rootPane.setDefaultButton(sendbutton);
}
use of javax.swing.JRootPane in project vcell by virtualcell.
the class EditorAboutFrame method createRootPane.
/**
* Overrides {@link JDialog#createRootPane()} to return a root pane that
* hides the window when the user presses the ESCAPE key.O
*/
protected JRootPane createRootPane() {
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
JRootPane rootPane = new JRootPane();
rootPane.registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
}, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
return rootPane;
}
use of javax.swing.JRootPane in project jmeter by apache.
the class SearchTreeDialog 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);
}
};
// Do search on Enter
Action enterAction = new AbstractAction("ENTER") {
private static final long serialVersionUID = -3661361497864527363L;
@Override
public void actionPerformed(ActionEvent actionEvent) {
doSearch(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;
}
Aggregations