Package java.awt

Examples of java.awt.KeyboardFocusManager


    private static AtomicBoolean lock = new AtomicBoolean(false);
    private static Robot robot = Util.createRobot();

    public static void main(String[] args) {
        boolean all_passed = true;
        KeyboardFocusManager testKFM = new TestKFM(robot);
        KeyboardFocusManager defKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();

        for (int i = 0; i < 10; i++) {
            test(testKFM, defKFM);
            Util.waitForIdle(robot);
            System.out.println("Iter " + i + ": " + (lock.get() ? "passed." : "failed!"));
View Full Code Here


        Robot r = Util.createRobot();
        Util.waitForIdle(r);
        Util.clickOnComp(btn1, r);
        Util.waitForIdle(r);
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (kfm.getFocusOwner() != btn1) {
            throw new RuntimeException("test error: can not set focus on " + btn1 + ".");
        }

        EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    final int n_comps = frame.getComponentCount();
                    for (int i = 0; i < n_comps; ++i) {
                        frame.getComponent(i).setVisible(false);
                    }
                }
            });
        Util.waitForIdle(r);
        final Component focus_owner = kfm.getFocusOwner();

        if (focus_owner != null && !focus_owner.isVisible()) {
            throw new RuntimeException("we have invisible focus owner");
        }
        System.out.println("test passed");
View Full Code Here

    public class TransferActionListener implements ActionListener,
            PropertyChangeListener {
        private JComponent focusOwner = null;

        public TransferActionListener() {
            KeyboardFocusManager manager = KeyboardFocusManager.
                    getCurrentKeyboardFocusManager();
            manager.addPropertyChangeListener("permanentFocusOwner", this);
        }
View Full Code Here

  if (components.contains(component) == false) {

    rootPane.getLayeredPane().remove(getModalPanel());
    rootPane.getLayeredPane().add(getModalPanel(), modalDepth);

    KeyboardFocusManager focusManager =
      KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.clearGlobalFocusOwner();
    getModalPanel().removeAll();
    getModalPanel().add("", component);
    resizeModalPanel();
    getModalPanel().repaint();
    components.add(component);
View Full Code Here

            } else if (row < getRowCount() - 1) {
                col = 0;
                row++;
            } else {
                // go to next component, no more rows in this table
                KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                manager.focusNextComponent();
                return;
            }
            changeSelection(row, col, false, false);
        }
View Full Code Here

        if (!isCellEditable(row, column))
            return false;

        // make sure our custom implementation of CellEditorRemover is created
        if (editorRemover == null) {
            KeyboardFocusManager fm =
                KeyboardFocusManager.getCurrentKeyboardFocusManager();
            editorRemover = new CellEditorRemover(fm);
            fm.addPropertyChangeListener("permanentFocusOwner", editorRemover);
        }

        // delegate to the default implementation
        return super.editCellAt(row, column,e);
    }
View Full Code Here

        ex.printStackTrace();
      }
      System.exit(43);
    }
    Window            win = null;
    KeyboardFocusManager    mng = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    if (win == null) {
      win = validateWindow(mng.getActiveWindow());
    }
    if (win == null) {
      win = validateWindow(mng.getFocusedWindow());
    }
    if (win == null) {
      win = validateWindow(JOptionPane.getRootFrame());
    }
    if (win == null){
View Full Code Here

    //---- create view movement controls panel
    viewMovementControlsPanel = CRComponentFactory.createFlowLayoutJPanel(-1, 60, this);
    this.setShowViewMovementControls(false);
   
    //---- create custom key even dispatcher
    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        manager.addKeyEventDispatcher(new KeyDispatcher());
       
        redisplayParameters();

  }
View Full Code Here

                public boolean dispatchKeyEvent (KeyEvent e) {
                    return DebugChords.dispatchKeyEvent(e);
                }
            };

            KeyboardFocusManager keymgr =
                KeyboardFocusManager.getCurrentKeyboardFocusManager();
            keymgr.addKeyEventDispatcher(_dispatcher);
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.KeyboardFocusManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.