Package java.awt

Examples of java.awt.KeyboardFocusManager


    f.setContentPane(new Jtme());
    resetColors();
    f.setFont(fonte);
    f.getContentPane().setBackground(backgroundColor);
    f.getContentPane().setFont(fonte);
    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    manager.addKeyEventDispatcher((KeyEventDispatcher) f.getContentPane());

    FontMetrics fonteM = f.getFontMetrics(f.getFont());
    int ascent = fonteM.getMaxAscent();
    int descent = fonteM.getMaxDescent();
    int advance = fonteM.getMaxAdvance(); // ou talvez fonteM.getWidths()[65]
View Full Code Here


        dispatchers = HashMultimap.create();
        dispatcherIds = Sets.newHashSet();
    }

    public void install() {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.addKeyEventDispatcher(this);
    }
View Full Code Here

        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.addKeyEventDispatcher(this);
    }

    public void uninstall() {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.removeKeyEventDispatcher(this);
    }
View Full Code Here

                }
            });
        }

        private boolean isButtonFocused() {
            KeyboardFocusManager m = KeyboardFocusManager.getCurrentKeyboardFocusManager();
            Component focusOwner = m.getFocusOwner();
            return focusOwner instanceof AbstractButton;
        }
View Full Code Here

*
*/
final class Test {

    public static void printFocusOwner(boolean nonPermanentToo) {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.addPropertyChangeListener("permanentFocusOwner", new FocusOwnerListener());
        if (nonPermanentToo) {
            kfm.addPropertyChangeListener("focusOwner", new PermanentFocusOwnerListener());
        }
    }
View Full Code Here

        }
    }
   
    @Override
    public boolean dispatch(KeyEvent evt, ApplicationWindow window) {
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        Component focusOwner = mgr.getFocusOwner();
        Component permanentFocusOwner = mgr.getPermanentFocusOwner();
        String info = "Focus owner: " + focusOwner + "\n\nPermanent focus owner: " + permanentFocusOwner;
        Alert.message(null, KongaTextArea.viewer(info, 8, 80), "Focused Components", Type.INFORMATION);
        return false;
    }
View Full Code Here

        }
    }

    public final Disposable install() {
        dispose();
        KeyboardFocusManager keyboard = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        keyboard.addKeyEventDispatcher(this);
        installed = new Disposable() {

            @Override
            public void dispose() {
                KeyboardFocusManager keyboard = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                keyboard.removeKeyEventDispatcher(MagicPhraseDetector.this);
                installed = null;
            }
        };
        return installed;
    }
View Full Code Here

        c.removeKeyListener(keyListener);
    }
   
    private void registerKeyEventDispatcher() {
        keyEventDispatcher = new KeyEventDispatcherImpl();
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        mgr.addKeyEventDispatcher(keyEventDispatcher);
    }
View Full Code Here

        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        mgr.addKeyEventDispatcher(keyEventDispatcher);
    }
   
    private void unregisterKeyEventDispatcher() {
        KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        mgr.removeKeyEventDispatcher(keyEventDispatcher);
    }
View Full Code Here

                doReturn();
            }
        }

        private void doReturn() {
            KeyboardFocusManager fmgr =
                KeyboardFocusManager.getCurrentKeyboardFocusManager();
            Component focusOwner = fmgr.getFocusOwner();
            if(focusOwner != null && !(focusOwner instanceof JRootPane)) {
                return;
            }

            MenuSelectionManager msm = MenuSelectionManager.defaultManager();
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.