예제 #1
0
 private Icon getIcon() {
   Icon rv = null;
   if (menuItem == null) {
     return rv;
   }
   WindowsMenuItemUIAccessor accessor = getAccessor(menuItem);
   State state = (accessor != null) ? accessor.getState(menuItem) : null;
   if (isEnabled(menuItem, null)) {
     if (state == State.PUSHED) {
       rv = menuItem.getPressedIcon();
     } else {
       rv = menuItem.getIcon();
     }
   } else {
     rv = menuItem.getDisabledIcon();
   }
   return rv;
 }
예제 #2
0
 private static boolean isEnabled(Component c, State state) {
   if (state == null && c instanceof JMenuItem) {
     WindowsMenuItemUIAccessor accessor = getAccessor((JMenuItem) c);
     if (accessor != null) {
       state = accessor.getState((JMenuItem) c);
     }
   }
   if (state == null) {
     if (c != null) {
       return c.isEnabled();
     } else {
       return true;
     }
   } else {
     return (state != State.DISABLED)
         && (state != State.DISABLEDHOT)
         && (state != State.DISABLEDPUSHED);
   }
 }