59 public Part getPart(JMenuItem menuItem) {
60 return WindowsMenuItemUI.getPart(this, menuItem);
61 }
62 };
63 public static ComponentUI createUI(JComponent b) {
64 return new WindowsRadioButtonMenuItemUI();
65 }
66
67 @Override
68 protected void paintBackground(Graphics g, JMenuItem menuItem,
69 Color bgColor) {
70 if (WindowsMenuItemUI.isVistaPainting()) {
71 WindowsMenuItemUI.paintBackground(accessor, g, menuItem, bgColor);
72 return;
73 }
74 super.paintBackground(g, menuItem, bgColor);
75 }
76
77 /**
78 * Method which renders the text of the current menu item.
79 * <p>
80 * @param g Graphics context
81 * @param menuItem Current menu item to render
82 * @param textRect Bounding rectangle to render the text.
83 * @param text String to render
84 * @since 1.4
85 */
86 protected void paintText(Graphics g, JMenuItem menuItem,
87 Rectangle textRect, String text) {
88 if (WindowsMenuItemUI.isVistaPainting()) {
89 WindowsMenuItemUI.paintText(accessor, g, menuItem, textRect, text);
90 return;
91 }
92 ButtonModel model = menuItem.getModel();
93 Color oldColor = g.getColor();
94
95 if(model.isEnabled() && model.isArmed()) {
96 g.setColor(selectionForeground); // Uses protected field.
97 }
98
99 WindowsGraphicsUtils.paintText(g, menuItem, textRect, text, 0);
|
59 public Part getPart(JMenuItem menuItem) {
60 return WindowsMenuItemUI.getPart(this, menuItem);
61 }
62 };
63 public static ComponentUI createUI(JComponent b) {
64 return new WindowsRadioButtonMenuItemUI();
65 }
66
67 @Override
68 protected void paintBackground(Graphics g, JMenuItem menuItem,
69 Color bgColor) {
70 if (WindowsMenuItemUI.isVistaPainting()) {
71 WindowsMenuItemUI.paintBackground(accessor, g, menuItem, bgColor);
72 return;
73 }
74 super.paintBackground(g, menuItem, bgColor);
75 }
76
77 /**
78 * Method which renders the text of the current menu item.
79 *
80 * @param g Graphics context
81 * @param menuItem Current menu item to render
82 * @param textRect Bounding rectangle to render the text.
83 * @param text String to render
84 * @since 1.4
85 */
86 protected void paintText(Graphics g, JMenuItem menuItem,
87 Rectangle textRect, String text) {
88 if (WindowsMenuItemUI.isVistaPainting()) {
89 WindowsMenuItemUI.paintText(accessor, g, menuItem, textRect, text);
90 return;
91 }
92 ButtonModel model = menuItem.getModel();
93 Color oldColor = g.getColor();
94
95 if(model.isEnabled() && model.isArmed()) {
96 g.setColor(selectionForeground); // Uses protected field.
97 }
98
99 WindowsGraphicsUtils.paintText(g, menuItem, textRect, text, 0);
|