Package java.awt

Examples of java.awt.KeyboardFocusManager


     * This method returns the traversal reason on the last focus change. This can be any of the FC_... constants in
     * the Constants class.
     * @return
     */
    public static int getTraversalReason() {
        KeyboardFocusManager currentMgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (currentMgr instanceof ForteKeyboardFocusManager)
            return ((ForteKeyboardFocusManager)currentMgr).getReasonCode();
        else {
            IllegalStateException errorVar = new IllegalStateException("A ForteKeyboardFocusManager has not been installed for this thread, so the traveral reason cannot be determined: " + Thread.currentThread());
            ErrorMgr.addError(errorVar);
View Full Code Here


            throw errorVar;
        }
    }

    public static void setSurpress() {
        KeyboardFocusManager currentMgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (currentMgr instanceof ForteKeyboardFocusManager)
            ((ForteKeyboardFocusManager)currentMgr).setReason(Constants.FC_SUPRESS);
        else {
            IllegalStateException errorVar = new IllegalStateException("A ForteKeyboardFocusManager has not been installed for this thread, so the traveral reason cannot be determined: " + Thread.currentThread());
            ErrorMgr.addError(errorVar);
View Full Code Here

     * needs to notify us that it's a programmatic action.
     *
     * CraigM:06/08/2008 - Changed to be a static method that gets the keyboard focus manager.
     */
    public static void setApplicationTraversal() {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (kfm instanceof ForteKeyboardFocusManager) {
          ((ForteKeyboardFocusManager)kfm).setReason(Constants.FC_APPLICATION);
        }
    }
View Full Code Here

     * Set the next focus traversal reason to STATECHANGE. This is necessary because there is nothing
     * in the event information to indicate the reason why the focus has changed, so the Focus action
     * needs to notify us that it's a programmatic action.
     */
    public static void setStateChangedTraversal() {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (kfm instanceof ForteKeyboardFocusManager) {
          ((ForteKeyboardFocusManager)kfm).setReason(Constants.FC_STATECHANGE);
        }
    }
View Full Code Here

    /**
     * Set the traversal reason to tab key.  This is handy for things like MultiLineTextField, where we
     * capture the tab traversal and repost it.  CraigM 05/10/2007.
     */
    public static void setTabTraversal(boolean pForward) {
        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        if (kfm instanceof ForteKeyboardFocusManager) {
            if (pForward) {
                ((ForteKeyboardFocusManager)kfm).setReason(Constants.FC_KEYNEXT);
            }
            else {
View Full Code Here

             * component in the form rather than move within the table.
             */
            protected void processKeyEvent( KeyEvent ke ) {
                if (ke.getKeyChar() == KeyEvent.VK_TAB) {
                    if (ke.getID() == KeyEvent.KEY_TYPED) {
                        KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                        if (ke.isShiftDown()) {
                            focusManager.focusPreviousComponent();
                        } else {
                            focusManager.focusNextComponent();
                        }
                    }
                    ke.consume();
                } else {
                    super.processKeyEvent(ke);
View Full Code Here

                if (ke.getKeyChar() == KeyEvent.VK_TAB) {//TAB key ?
                    if (getModel().getRowCount() == (getSelectedRow() + 1)) {//last row ?
                        if (getSelectedColumn() == (getColumnCount() - 1)) {//last column ?
                            if (ke.getID() == KeyEvent.KEY_TYPED) {//shift-TAB ?
                                KeyboardFocusManager focusManager = KeyboardFocusManager
                                .getCurrentKeyboardFocusManager();
                                if (ke.isShiftDown()) {
                                    focusManager.focusPreviousComponent();
                                } else {
                                    //int selRow = getSelectedRow();
                                    clearSelection();
                                    focusManager.focusNextComponent();
                                }
                            }
                        } else {
                            setColumnSelectionInterval(getColumnCount() - 1, getColumnCount() - 1);
                        }
                    } else {
                        if (ke.isShiftDown()) {
                            KeyboardFocusManager focusManager = KeyboardFocusManager
                            .getCurrentKeyboardFocusManager();
                            if (getSelectedRow() == 0) {
                                if (getSelectedColumn() == 0) {
                                    clearSelection();
                                    focusManager.focusPreviousComponent();
                                } else {
                                    setColumnSelectionInterval(
                                            getColumnCount() - 1,
                                            getColumnCount() - 1);
                                    super.processKeyEvent(ke);
View Full Code Here

             * component in the form rather than move within the table.
             */
            protected void processKeyEvent( KeyEvent ke ) {
                if (ke.getKeyChar() == KeyEvent.VK_TAB) {
                    if (ke.getID() == KeyEvent.KEY_TYPED) {
                        KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
                        if (ke.isShiftDown()) {
                            focusManager.focusPreviousComponent();
                        } else {
                            focusManager.focusNextComponent();
                        }
                    }
                    ke.consume();
                } else {
                    super.processKeyEvent(ke);
View Full Code Here

                if (ke.getKeyChar() == KeyEvent.VK_TAB) {//TAB key ?
                    if (getModel().getRowCount() == (getSelectedRow() + 1)) {//last row ?
                        if (getSelectedColumn() == (getColumnCount() - 1)) {//last column ?
                            if (ke.getID() == KeyEvent.KEY_TYPED) {//shift-TAB ?
                                KeyboardFocusManager focusManager = KeyboardFocusManager
                                .getCurrentKeyboardFocusManager();
                                if (ke.isShiftDown()) {
                                    focusManager.focusPreviousComponent();
                                } else {
                                    //int selRow = getSelectedRow();
                                    clearSelection();
                                    focusManager.focusNextComponent();
                                }
                            }
                        } else {
                            setColumnSelectionInterval(getColumnCount() - 1, getColumnCount() - 1);
                        }
                    } else {
                        if (ke.isShiftDown()) {
                            KeyboardFocusManager focusManager = KeyboardFocusManager
                            .getCurrentKeyboardFocusManager();
                            if (getSelectedRow() == 0) {
                                if (getSelectedColumn() == 0) {
                                    clearSelection();
                                    focusManager.focusPreviousComponent();
                                } else {
                                    setColumnSelectionInterval(
                                            getColumnCount() - 1,
                                            getColumnCount() - 1);
                                    super.processKeyEvent(ke);
View Full Code Here

    }

    //This determines if the append row has occurred from within the table or from outside
    public void shouldIgnoreRowChange(MouseEvent event) {
        if (!table.isFocusOwner()) {
            KeyboardFocusManager fm = KeyboardFocusManager.getCurrentKeyboardFocusManager();

            if (!isAssociatedComponent((Component)fm.getFocusOwner(), false)) {
                setIgnoreRowChange(true, true);
            }
        }
    }
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.