Package java.awt

Examples of java.awt.KeyboardFocusManager


        PROP_EVENTS.add(PERMANENT_FOCUS_OWNER);
        PROP_EVENTS.add(ACTIVE_WINDOW);

        EventQueue.invokeLater(new Runnable() {
                public void run() {
                    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                    focusManager.addPropertyChangeListener(SINGLETON);
                }
            });

        Toolkit.getDefaultToolkit().addAWTEventListener(SINGLETON, AWTEvent.MOUSE_EVENT_MASK);
    }
View Full Code Here


            }
        }
    }

    private void udpateTabChangeFocus(final Dockable dockable) {
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        Dockable focusParent = DockingUtility.getAncestorDockable(mgr.getFocusOwner());
        if(focusParent==null || focusParent==dockable)
            return;

        // the current focusParent-dockable is different than the currently active dockable.
        // we'll need to update the focus component
View Full Code Here

            ((JComponent)c).putClientProperty(key, null);
        }
    }

    public static Window getActiveWindow() {
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        return mgr.getActiveWindow();
    }
View Full Code Here

        return LookAndFeelSettings.isSkinLFSupported();

    }

    public static void toggleFocus(int direction) {
  KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        Component focused = manager.getFocusOwner();
  Component newFocused = getNext(focused, direction);
  if (newFocused != null) {
      SwingUtility.focus(newFocused);
  }
    }
View Full Code Here

            //ex.printStackTrace();
            //success = false;
            //}
            if (!success) {
                try {
                    KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                    // #swingx-697
                    // In some cases panel is not focused after the creation leaving bogus dispatcher in place. If found remove it.
                    if (ked != null) {
                        kfm.removeKeyEventDispatcher(ked);
                    }
                    // Temporarily installed listener with auto-uninstall after
                    // test is finished.
                    ked = new RemovableKeyEventDispatcher(this);
                    kfm.addKeyEventDispatcher(ked);
                    Robot r = new Robot();
                    isTestingCaps = true;
                    r.keyPress(65);
                    r.keyRelease(65);
                    r.keyPress(KeyEvent.VK_BACK_SPACE);
View Full Code Here

    /**
     * removes the standard editor remover and adds the custom remover.
     *
     */
    private void hackEditorRemover() {
        KeyboardFocusManager manager = KeyboardFocusManager
                .getCurrentKeyboardFocusManager();
        PropertyChangeListener[] listeners = manager
                .getPropertyChangeListeners("permanentFocusOwner");
        for (int i = listeners.length - 1; i >= 0; i--) {
            if (listeners[i].getClass().getName().startsWith(
                    "javax.swing.JTable")) {
                manager.removePropertyChangeListener("permanentFocusOwner",
                        listeners[i]);
                break;
            }
        }
        if (editorRemover == null) {
View Full Code Here

        /**
         * Updates itself to listen to the current KeyboardFocusManager.
         *
         */
        public void updateKeyboardFocusManager() {
            KeyboardFocusManager current = KeyboardFocusManager.getCurrentKeyboardFocusManager();
            setKeyboardFocusManager(current);
        }
View Full Code Here

         * @param current the KeyboardFocusManager to listen too.
         */
        private void setKeyboardFocusManager(KeyboardFocusManager current) {
            if (focusManager == current)
                return;
            KeyboardFocusManager old = focusManager;
            if (old != null) {
                old.removePropertyChangeListener("permanentFocusOwner", this);
            }
            focusManager = current;
            if (focusManager != null) {
                focusManager.addPropertyChangeListener("permanentFocusOwner",
                        this);
View Full Code Here

            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }

        final KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.addKeyEventDispatcher(new KeyEventDispatcher() {
            @Override
            public boolean dispatchKeyEvent(KeyEvent e) {
                if (e.getID() != KeyEvent.KEY_TYPED) return false;
                if (e.getKeyChar() == 'i') printCommonDebug();
                if (e.getKeyChar() == 'p') printPropertiesDebug();
View Full Code Here

        KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalPolicy(new DefaultFocusTraversalPolicy());
        focusManagerEnabled = false;
    }

    public static FocusManager getCurrentManager() {
        KeyboardFocusManager currentManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (currentManager instanceof FocusManager) {
            return (FocusManager)currentManager;
        }
        return null;
    }
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.