Java Code Examples for com.sun.java.swing.plaf.windows.TMSchema.State#NORMAL

The following examples show how to use com.sun.java.swing.plaf.windows.TMSchema.State#NORMAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowsMenuUI.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 2
Source File: WindowsMenuUI.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 3
Source File: WindowsMenuUI.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 4
Source File: WindowsMenuUI.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 5
Source File: WindowsMenuUI.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 6
Source File: WindowsMenuUI.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 7
Source File: WindowsMenuUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 8
Source File: WindowsMenuUI.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 9
Source File: WindowsMenuUI.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 10
Source File: WindowsMenuUI.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 11
Source File: WindowsMenuUI.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 12
Source File: WindowsMenuUI.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 13
Source File: WindowsMenuUI.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 14
Source File: WindowsMenuUI.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}
 
Example 15
Source File: WindowsMenuUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public State getState(JMenuItem menu) {
    State state = menu.isEnabled() ? State.NORMAL
            : State.DISABLED;
    ButtonModel model = menu.getModel();
    if (model.isArmed() || model.isSelected()) {
        state = (menu.isEnabled()) ? State.PUSHED
                : State.DISABLEDPUSHED;
    } else if (model.isRollover()
               && ((JMenu) menu).isTopLevelMenu()) {
        /*
         * Only paint rollover if no other menu on menubar is
         * selected
         */
        State stateTmp = state;
        state = (menu.isEnabled()) ? State.HOT
                : State.DISABLEDHOT;
        for (MenuElement menuElement :
            ((JMenuBar) menu.getParent()).getSubElements()) {
            if (((JMenuItem) menuElement).isSelected()) {
                state = stateTmp;
                break;
            }
        }
    }

    //non top level menus have HOT state instead of PUSHED
    if (!((JMenu) menu).isTopLevelMenu()) {
        if (state == State.PUSHED) {
            state = State.HOT;
        } else if (state == State.DISABLEDPUSHED) {
            state = State.DISABLEDHOT;
        }
    }

    /*
     * on Vista top level menu for non active frame looks disabled
     */
    if (((JMenu) menu).isTopLevelMenu() && WindowsMenuItemUI.isVistaPainting()) {
        if (! WindowsMenuBarUI.isActive(menu)) {
            state = State.DISABLED;
        }
    }
    return state;
}