Search in sources :

Example 26 with JRootPane

use of javax.swing.JRootPane in project abstools by abstools.

the class ButtonPanel method setDefaultButton.

/*
	 * This method is called each time a button or an ancestor is added.
	 * So the root pane that contains this ButtonPanel will be informed
	 * about the default button (if present) in any case, whether the
	 * ButtonPanel has already been added to it as a descendant or whether
	 * it is added later.
	 */
private void setDefaultButton() {
    if (defaultButton != null) {
        Component comp = ButtonPanel.this;
        while (comp != null && !(comp instanceof JRootPane)) {
            comp = comp.getParent();
        }
        if (comp != null) {
            ((JRootPane) comp).setDefaultButton(defaultButton);
            // default button has been successfully set, "erase" it now
            defaultButton = null;
        }
    }
}
Also used : JRootPane(javax.swing.JRootPane) Component(java.awt.Component)

Example 27 with JRootPane

use of javax.swing.JRootPane in project Course_Generator by patrovite.

the class FrmExportWaypoints 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;
}
Also used : Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) InputMap(javax.swing.InputMap) AbstractAction(javax.swing.AbstractAction)

Example 28 with JRootPane

use of javax.swing.JRootPane in project keystore-explorer by kaikramer.

the class JEscFrame method createRootPane.

@Override
protected JRootPane createRootPane() {
    JRootPane rootPane = new JRootPane();
    // Escape key closes dialogs
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "escapeKey");
    rootPane.getActionMap().put("escapeKey", new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
            dispose();
        }
    });
    return rootPane;
}
Also used : ActionEvent(java.awt.event.ActionEvent) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) AbstractAction(javax.swing.AbstractAction)

Example 29 with JRootPane

use of javax.swing.JRootPane in project cytoscape-impl by cytoscape.

the class SimpleRootPaneContainer method setRootPane.

protected void setRootPane(JRootPane root) {
    if (rootPane != null)
        remove(rootPane);
    JRootPane oldValue = getRootPane();
    rootPane = root;
    if (rootPane != null) {
        boolean checkingEnabled = isRootPaneCheckingEnabled();
        try {
            setRootPaneCheckingEnabled(false);
            add(rootPane, BorderLayout.CENTER);
        } finally {
            setRootPaneCheckingEnabled(checkingEnabled);
        }
    }
    firePropertyChange("rootPane", oldValue, root);
}
Also used : JRootPane(javax.swing.JRootPane)

Example 30 with JRootPane

use of javax.swing.JRootPane in project blue by kunstmusik.

the class TreeHilightDropListener method dragEnter.

@Override
public void dragEnter(DropTargetDragEvent dtde) {
    JTree tree = (JTree) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    JRootPane rootPane = tree.getRootPane();
    oldGlassPane = rootPane.getGlassPane();
    rootPane.setGlassPane(glassPane);
    glassPane.setOpaque(false);
    glassPane.setVisible(true);
    updateLine(tree, location);
}
Also used : JTree(javax.swing.JTree) JRootPane(javax.swing.JRootPane) Point(java.awt.Point)

Aggregations

JRootPane (javax.swing.JRootPane)90 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)35 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 Container (java.awt.Container)10 FlowLayout (java.awt.FlowLayout)10 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6