59
60 public Part getPart(JMenuItem menuItem) {
61 return WindowsMenuItemUI.getPart(this, menuItem);
62 }
63 };
64 public static ComponentUI createUI(JComponent b) {
65 return new WindowsCheckBoxMenuItemUI();
66 }
67
68 @Override
69 protected void paintBackground(Graphics g, JMenuItem menuItem,
70 Color bgColor) {
71 if (WindowsMenuItemUI.isVistaPainting()) {
72 WindowsMenuItemUI.paintBackground(accessor, g, menuItem, bgColor);
73 return;
74 }
75 super.paintBackground(g, menuItem, bgColor);
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,
90 textRect, text);
91 return;
92 }
93 ButtonModel model = menuItem.getModel();
94 Color oldColor = g.getColor();
95
96 if(model.isEnabled() && model.isArmed()) {
97 g.setColor(selectionForeground); // Uses protected field.
98 }
99
|
59
60 public Part getPart(JMenuItem menuItem) {
61 return WindowsMenuItemUI.getPart(this, menuItem);
62 }
63 };
64 public static ComponentUI createUI(JComponent b) {
65 return new WindowsCheckBoxMenuItemUI();
66 }
67
68 @Override
69 protected void paintBackground(Graphics g, JMenuItem menuItem,
70 Color bgColor) {
71 if (WindowsMenuItemUI.isVistaPainting()) {
72 WindowsMenuItemUI.paintBackground(accessor, g, menuItem, bgColor);
73 return;
74 }
75 super.paintBackground(g, menuItem, bgColor);
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,
90 textRect, text);
91 return;
92 }
93 ButtonModel model = menuItem.getModel();
94 Color oldColor = g.getColor();
95
96 if(model.isEnabled() && model.isArmed()) {
97 g.setColor(selectionForeground); // Uses protected field.
98 }
99
|