Package java.awt

Examples of java.awt.AWTKeyStroke


    public void processKeyEvent(Component focusedComponent, KeyEvent e) {
        if (e.getID() == KeyEvent.KEY_PRESSED && focusedComponent.getFocusTraversalKeysEnabled() && !e.isConsumed())
        {
            this.handleArrowKeys(focusedComponent, e);

            AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
            AWTKeyStroke oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
                                                    stroke.getModifiers(),
                                                    !stroke.isOnKeyRelease());
            Set<AWTKeyStroke> toTest;
            boolean reasonSet = false;
View Full Code Here


    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
        return oldInstance.equals(newInstance);
    }

    protected Expression instantiate(Object oldInstance, Encoder out) {
        AWTKeyStroke key = (AWTKeyStroke) oldInstance;

        char ch = key.getKeyChar();
        int code = key.getKeyCode();
        int mask = key.getModifiers();
        boolean onKeyRelease = key.isOnKeyRelease();

        Object[] args = null;
        if (ch == KeyEvent.CHAR_UNDEFINED) {
            args = !onKeyRelease
                    ? new Object[]{code, mask}
                    : new Object[]{code, mask, onKeyRelease};
        } else if (code == KeyEvent.VK_UNDEFINED) {
            if (!onKeyRelease) {
                args = (mask == 0)
                        ? new Object[]{ch}
                        : new Object[]{ch, mask};
            } else if (mask == 0) {
                args = new Object[]{ch, onKeyRelease};
            }
        }
        if (args == null) {
            throw new IllegalStateException("Unsupported KeyStroke: " + key);
        }
        Class type = key.getClass();
        String name = type.getName();
        // get short name of the class
        int index = name.lastIndexOf('.') + 1;
        if (index > 0) {
            name = name.substring(index);
View Full Code Here

    protected boolean mutatesTo(Object oldInstance, Object newInstance) {
        return oldInstance.equals(newInstance);
    }

    protected Expression instantiate(Object oldInstance, Encoder out) {
        AWTKeyStroke key = (AWTKeyStroke) oldInstance;

        char ch = key.getKeyChar();
        int code = key.getKeyCode();
        int mask = key.getModifiers();
        boolean onKeyRelease = key.isOnKeyRelease();

        Object[] args = null;
        if (ch == KeyEvent.CHAR_UNDEFINED) {
            args = !onKeyRelease
                    ? new Object[]{code, mask}
                    : new Object[]{code, mask, onKeyRelease};
        } else if (code == KeyEvent.VK_UNDEFINED) {
            if (!onKeyRelease) {
                args = (mask == 0)
                        ? new Object[]{ch}
                        : new Object[]{ch, mask};
            } else if (mask == 0) {
                args = new Object[]{ch, onKeyRelease};
            }
        }
        if (args == null) {
            throw new IllegalStateException("Unsupported KeyStroke: " + key);
        }
        Class type = key.getClass();
        String name = type.getName();
        // get short name of the class
        int index = name.lastIndexOf('.') + 1;
        if (index > 0) {
            name = name.substring(index);
View Full Code Here

        if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
            return false;
        }

        AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
        Set toTest;
        Component currentFocused = e.getComponent();

        Component last = getFocusTraversalPolicy().getLastComponent(this);
        toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
View Full Code Here

    /**
     * Checks the key event is the input method selection key or not.
     */
    private boolean checkInputMethodSelectionKey(KeyEvent event) {
        if (inputMethodSelectionKey != null) {
            AWTKeyStroke aKeyStroke = AWTKeyStroke.getAWTKeyStrokeForEvent(event);
            return inputMethodSelectionKey.equals(aKeyStroke);
        } else {
            return false;
        }
    }
View Full Code Here

    private boolean checkPageNavigation(KeyEvent e) {
        if (SwingUtilities.getWindowAncestor(e.getComponent()) != appWin.getFrame()) {
            return false;
        }
        AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
        int editors = appWin.getEditorService().getNumberOfEditors();
        if (ks.equals(ctrlTab)) {
            if (editors >= 2) {
                selectEditor(Direction.NEXT);
            }
            return true;
        } else if (ks.equals(ctrlShiftTab)) {
            if (editors >= 2) {
                selectEditor(Direction.PREVIOUS);
            }
            return true;
        }
View Full Code Here

            if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                cancel();
            } else if ((e.getID() == KeyEvent.KEY_RELEASED) && (e.getKeyCode() == KeyEvent.VK_CONTROL)) {
                finalSelectionMade();
            } else {
                AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
                if (moveDownKeys.contains(ks)) {
                    updateSelection(Direction.NEXT);
                    return true;
                }
                if (moveUpKeys.contains(ks)) {
View Full Code Here

        if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
            return false;
        }

        AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
        Set toTest;
        Component currentFocused = e.getComponent();

        Component last = getFocusTraversalPolicy().getLastComponent(this);
        toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
View Full Code Here

TOP

Related Classes of java.awt.AWTKeyStroke

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.