53 new WindowsMenuItemUIAccessor() {
54
55 public JMenuItem getMenuItem() {
56 return menuItem;
57 }
58
59 public State getState(JMenuItem menuItem) {
60 return WindowsMenuItemUI.getState(this, menuItem);
61 }
62
63 public Part getPart(JMenuItem menuItem) {
64 return WindowsMenuItemUI.getPart(this, menuItem);
65 }
66 };
67 public static ComponentUI createUI(JComponent c) {
68 return new WindowsMenuItemUI();
69 }
70
71 /**
72 * Method which renders the text of the current menu item.
73 * <p>
74 * @param g Graphics context
75 * @param menuItem Current menu item to render
76 * @param textRect Bounding rectangle to render the text.
77 * @param text String to render
78 */
79 protected void paintText(Graphics g, JMenuItem menuItem,
80 Rectangle textRect, String text) {
81 if (WindowsMenuItemUI.isVistaPainting()) {
82 WindowsMenuItemUI.paintText(accessor, g, menuItem, textRect, text);
83 return;
84 }
85 ButtonModel model = menuItem.getModel();
86 Color oldColor = g.getColor();
87
88 if(model.isEnabled() &&
89 (model.isArmed() || (menuItem instanceof JMenu &&
90 model.isSelected()))) {
91 g.setColor(selectionForeground); // Uses protected field.
92 }
93
|
53 new WindowsMenuItemUIAccessor() {
54
55 public JMenuItem getMenuItem() {
56 return menuItem;
57 }
58
59 public State getState(JMenuItem menuItem) {
60 return WindowsMenuItemUI.getState(this, menuItem);
61 }
62
63 public Part getPart(JMenuItem menuItem) {
64 return WindowsMenuItemUI.getPart(this, menuItem);
65 }
66 };
67 public static ComponentUI createUI(JComponent c) {
68 return new WindowsMenuItemUI();
69 }
70
71 /**
72 * Method which renders the text of the current menu item.
73 *
74 * @param g Graphics context
75 * @param menuItem Current menu item to render
76 * @param textRect Bounding rectangle to render the text.
77 * @param text String to render
78 */
79 protected void paintText(Graphics g, JMenuItem menuItem,
80 Rectangle textRect, String text) {
81 if (WindowsMenuItemUI.isVistaPainting()) {
82 WindowsMenuItemUI.paintText(accessor, g, menuItem, textRect, text);
83 return;
84 }
85 ButtonModel model = menuItem.getModel();
86 Color oldColor = g.getColor();
87
88 if(model.isEnabled() &&
89 (model.isArmed() || (menuItem instanceof JMenu &&
90 model.isSelected()))) {
91 g.setColor(selectionForeground); // Uses protected field.
92 }
93
|