微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.awt.KeyEventPostProcessor的实例源码

项目:bigwarp    文件BigWarp.java   
public void closeAll()
{
    final ArrayList< KeyEventPostProcessor > ks = new ArrayList< KeyEventPostProcessor >( keyEventPostProcessorSet );
    for ( final KeyEventPostProcessor ke : ks )
        removeKeyEventPostProcessor( ke );

    repeatedKeyEventsFixer.remove();

    viewerFrameP.setVisible( false );
    viewerFrameQ.setVisible( false );
    landmarkFrame.setVisible( false );

    viewerFrameP.getViewerPanel().stop();
    viewerFrameQ.getViewerPanel().stop();

    viewerFrameP.dispose();
    viewerFrameQ.dispose();
    landmarkFrame.dispose();
}
项目:Openjsharp    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,if the source is a JComponent it implies that
    // processKeyEvent was already invoked and thus no need to process
    // the bindings again,unless the Component is disabled,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:jdk8u-jdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:openjdk-jdk10    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:openjdk9    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:Java8CN    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:geoxygene    文件Picking.java   
/**
 * Crée un comportement de picking
 * 
 * @param canvas
 *            le canvas dans lequel est créé le picking
 * @param scene
 *            le BranchGroup contenant les éléments à sélectionner
 */
public Picking(Canvas3D canvas,BranchGroup scene) {

    this.canvas3D = canvas;

    this.pickCanvas = new PickCanvas(this.canvas3D,scene);
    // Tolérance à partir de laquelle les objets en fonction de la distance
    // avec la souris
    // sera sélectionnée
    this.pickCanvas.setTolerance(5f);
    // Pour avoir des infos à partir des frontières de l'objet intersecté
    this.pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO);

    // Le bouton controle est il enfoncé ?
    KeyboardFocusManager kbm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    kbm.addKeyEventPostProcessor(new KeyEventPostProcessor() {
        @Override
        public boolean postProcessKeyEvent(KeyEvent e) {
            if (e.getModifiers() == InputEvent.CTRL_MASK) {
                if (e.getID() == KeyEvent.KEY_pressed) {
                    Picking.PICKING_IS_CTRL_pressed = true;
                }
            }
            if (e.getID() == KeyEvent.KEY_RELEASED) {
                Picking.PICKING_IS_CTRL_pressed = false;
            }
            return false;
        }
    });

}
项目:jdk8u_jdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:lookaside_java-1.8.0-openjdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:infobip-open-jdk-8    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:jdk8u-dev-jdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:OLD-OpenJDK8    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:openjdk-jdk7u-jdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:openjdk-icedtea7    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:leader_election    文件GenerateNodesDialog.java   
/**
 * The constructor for the GenerateNodesDialog class.
 *
 * @param p The parent Frame to add the Dialog to.
 */
public GenerateNodesDialog(GUI p){
    super(p,"Create new Nodes",true);
    GuiHelper.setwindowIcon(this);
    cancel.addActionListener(this);
    ok.addActionListener(this);

    Font f = distributionModelComboBox.getFont().deriveFont(Font.PLAIN);
    distributionModelComboBox.setFont(f);
    nodeTypeComboBox.setFont(f);
    connectivityModelComboBox.setFont(f);
    interferenceModelComboBox.setFont(f);
    mobilityModelComboBox.setFont(f);
    reliabilityModelComboBox.setFont(f);

    // Detect ESCAPE button
    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addKeyEventPostProcessor(new KeyEventPostProcessor() {
        public boolean postProcessKeyEvent(KeyEvent e) {
            if(!e.isConsumed() && e.getID() == KeyEvent.KEY_pressed && e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                GenerateNodesDialog.this.setVisible(false);
            }
            return false;
        }
    });

    this.setLocationRelativeto(p);
    this.parent = p;
}
项目:bigwarp    文件BigWarp.java   
public void addKeyEventPostProcessor( final KeyEventPostProcessor ke )
{
    keyEventPostProcessorSet.add( ke );
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor( ke );
}
项目:bigwarp    文件BigWarp.java   
public void removeKeyEventPostProcessor( final KeyEventPostProcessor ke )
{
    keyEventPostProcessorSet.remove( ke );
    KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor( ke );
}
项目:jdk7-jdk    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Enable the Swing default LayoutManager.
    String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
    // don't set default policy if this is XAWT.
    if (!"sun.awt.X11.XToolkit".equals(toolkitName)) {
        if (FocusManager.isFocusManagerEnabled()) {
            KeyboardFocusManager.getCurrentKeyboardFocusManager().
                setDefaultFocusTraversalPolicy(
                    new LayoutFocusTraversalPolicy());
        }
    }

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:openjdk-source-code-learn    文件UIManager.java   
private static void initialize() {
    Properties swingProps = loadSwingProperties();
    initializeSystemDefaults(swingProps);
    initializeDefaultLAF(swingProps);
    initializeAuxiliaryLAFs(swingProps);
    initializeInstalledLAFs(swingProps);

    // Enable the Swing default LayoutManager.
    String toolkitName = Toolkit.getDefaultToolkit().getClass().getName();
    // don't set default policy if this is XAWT.
    if (!"sun.awt.X11.XToolkit".equals(toolkitName)) {
        if (FocusManager.isFocusManagerEnabled()) {
            KeyboardFocusManager.getCurrentKeyboardFocusManager().
                setDefaultFocusTraversalPolicy(
                    new LayoutFocusTraversalPolicy());
        }
    }

    // Install Swing's PaintEventdispatcher
    if (RepaintManager.HANDLE_TOP_LEVEL_PAINT) {
        sun.awt.PaintEventdispatcher.setPaintEventdispatcher(
                                    new SwingPaintEventdispatcher());
    }
    // Install a hook that will be invoked if no one consumes the
    // KeyEvent.  If the source isn't a JComponent this will process
    // key bindings,in which
    // case KeyEvents will no longer be dispatched to it so that we
    // handle it here.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
            addKeyEventPostProcessor(new KeyEventPostProcessor() {
                public boolean postProcessKeyEvent(KeyEvent e) {
                    Component c = e.getComponent();

                    if ((!(c instanceof JComponent) ||
                         (c != null && !c.isEnabled())) &&
                            JComponent.KeyboardState.shouldProcess(e) &&
                            SwingUtilities.processKeyBindings(e)) {
                        e.consume();
                        return true;
                    }
                    return false;
                }
            });
    AWTAccessor.getComponentAccessor().
        setRequestFocusController(JComponent.focusController);
}
项目:leader_election    文件GlobalSettingsDialog.java   
/**
 * The constructor for the GlobalSettingsDialog class.
 *
 * @param parent The parent Frame to attach the dialog to.
 */
public GlobalSettingsDialog(JFrame parent){
    super(parent,"Global Settings",true);
    GuiHelper.setwindowIcon(this);

    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(650,500));

    JTextArea text = new JTextArea();
    text.setEditable(false);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    Configuration.printConfiguration(new PrintStream(os));
    text.setText(os.toString());
    text.setCaretPosition(0); // ensure that the top of the text is shown 
    JScrollPane spane = new JScrollPane(text);
    this.add(spane);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BorderLayout());

    JPanel settingsPanel = new JPanel();
    settingsPanel.setLayout(new BorderLayout());

    testForUpdatesAtStartup.setSelected(AppConfig.getAppConfig().checkForSinalgoUpdate);
    testForUpdatesAtStartup.addActionListener(this);
    settingsPanel.add(BorderLayout.LINE_START,testForUpdatesAtStartup);

    versionTest.addActionListener(this);
    settingsPanel.add(BorderLayout.EAST,versionTest);

    buttonPanel.add(settingsPanel);

    close.addActionListener(this);
    JPanel closePanel = new JPanel();
    closePanel.add(close);
    buttonPanel.add(BorderLayout.soUTH,closePanel);

    this.add(BorderLayout.soUTH,buttonPanel);

    // Detect ESCAPE button
    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addKeyEventPostProcessor(new KeyEventPostProcessor() {
        public boolean postProcessKeyEvent(KeyEvent e) {
            if(!e.isConsumed() && e.getID() == KeyEvent.KEY_pressed && e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                GlobalSettingsDialog.this.setVisible(false);
            }
            return false;
        }
    });

    this.getRootPane().setDefaultButton(close);

    this.pack();
    this.setLocationRelativeto(parent);
    this.setVisible(true);
}
项目:javify    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void addKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.addKeyEventPostProcessor(p);
}
项目:javify    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.removeKeyEventPostProcessor(p);
}
项目:jvm-stm    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void addKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.addKeyEventPostProcessor(p);
}
项目:jvm-stm    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.removeKeyEventPostProcessor(p);
}
项目:JamVM-PH    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void addKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.addKeyEventPostProcessor(p);
}
项目:JamVM-PH    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.removeKeyEventPostProcessor(p);
}
项目:classpath    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void addKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.addKeyEventPostProcessor(p);
}
项目:classpath    文件FocusManager.java   
/**
 * Wraps
 * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
 *
 * @param p the post processor
 */
public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
{
  wrapped.removeKeyEventPostProcessor(p);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。