예제 #1
0
 public int getIconWidth() {
   Icon lafIcon = getLaFIcon();
   if (lafIcon != null) {
     return lafIcon.getIconWidth();
   }
   Icon icon = getIcon();
   int width = 0;
   if (icon != null) {
     width = icon.getIconWidth() + 2 * OFFSET;
   } else {
     width = VistaMenuItemCheckIconFactory.getIconWidth();
   }
   return width;
 }
예제 #2
0
 public int getIconHeight() {
   Icon lafIcon = getLaFIcon();
   if (lafIcon != null) {
     return lafIcon.getIconHeight();
   }
   Icon icon = getIcon();
   int height = 0;
   if (icon != null) {
     height = icon.getIconHeight() + 2 * OFFSET;
   } else {
     Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
     height = skin.getHeight() + 2 * OFFSET;
   }
   return height;
 }
예제 #3
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Icon lafIcon = getLaFIcon();
   if (lafIcon != null) {
     lafIcon.paintIcon(c, g, x, y);
     return;
   }
   assert menuItem == null || c == menuItem;
   Icon icon = getIcon();
   if (type == JCheckBoxMenuItem.class || type == JRadioButtonMenuItem.class) {
     AbstractButton b = (AbstractButton) c;
     if (b.isSelected()) {
       Part backgroundPart = Part.MP_POPUPCHECKBACKGROUND;
       Part part = Part.MP_POPUPCHECK;
       State backgroundState;
       State state;
       if (isEnabled(c, null)) {
         backgroundState = (icon != null) ? State.BITMAP : State.NORMAL;
         state =
             (type == JRadioButtonMenuItem.class) ? State.BULLETNORMAL : State.CHECKMARKNORMAL;
       } else {
         backgroundState = State.DISABLEDPUSHED;
         state =
             (type == JRadioButtonMenuItem.class)
                 ? State.BULLETDISABLED
                 : State.CHECKMARKDISABLED;
       }
       Skin skin;
       XPStyle xp = XPStyle.getXP();
       skin = xp.getSkin(c, backgroundPart);
       skin.paintSkin(g, x, y, getIconWidth(), getIconHeight(), backgroundState);
       if (icon == null) {
         skin = xp.getSkin(c, part);
         skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
       }
     }
   }
   if (icon != null) {
     icon.paintIcon(c, g, x + OFFSET, y + OFFSET);
   }
 }