This commit is contained in:
prrace 2025-08-14 09:50:12 -07:00
parent f991a86e4b
commit a1f59db142

View file

@ -167,35 +167,6 @@ public final class WindowsMenuItemUI extends BasicMenuItemUI {
changeListener = null; changeListener = null;
} }
private static void applyInsets(Rectangle rect, Insets insets) {
SwingUtilities3.applyInsets(rect, insets);
}
private static void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr,
Color holdc, Color foreground) {
SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground);
}
private static void paintIcon(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr, Color holdc) {
SwingUtilities3.paintIcon(g, lh, lr, holdc);
}
private static void paintAccText(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr) {
SwingUtilities3.paintAccText(g, lh, lr,
disabledForeground,
acceleratorSelectionForeground,
acceleratorForeground);
}
private static void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh,
MenuItemLayoutHelper.LayoutResult lr,
Color foreground) {
SwingUtilities3.paintArrowIcon(g, lh, lr, foreground);
}
protected void paintMenuItem(Graphics g, JComponent c, protected void paintMenuItem(Graphics g, JComponent c,
Icon checkIcon, Icon arrowIcon, Icon checkIcon, Icon arrowIcon,
Color background, Color foreground, Color background, Color foreground,
@ -223,7 +194,7 @@ public final class WindowsMenuItemUI extends BasicMenuItemUI {
g.setFont(mi.getFont()); g.setFont(mi.getFont());
Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight()); Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
applyInsets(viewRect, mi.getInsets()); SwingUtilities3.applyInsets(viewRect, mi.getInsets());
String acceleratorDelimiter = String acceleratorDelimiter =
UIManager.getString("MenuItem.acceleratorDelimiter"); UIManager.getString("MenuItem.acceleratorDelimiter");
@ -241,8 +212,8 @@ public final class WindowsMenuItemUI extends BasicMenuItemUI {
MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();
paintBackground(accessor, g, mi, background); paintBackground(accessor, g, mi, background);
paintCheckIcon(g, lh, lr, holdc, foreground); SwingUtilities3.paintCheckIcon(g, lh, lr, holdc, foreground);
paintIcon(g, lh, lr, holdc); SwingUtilities3.paintIcon(g, lh, lr, holdc);
if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) {
Rectangle rect = lr.getTextRect(); Rectangle rect = lr.getTextRect();
@ -266,8 +237,10 @@ public final class WindowsMenuItemUI extends BasicMenuItemUI {
rect.x += lh.getAfterCheckIconGap(); rect.x += lh.getAfterCheckIconGap();
lr.setAccRect(rect); lr.setAccRect(rect);
} }
paintAccText(g, lh, lr); SwingUtilities3.paintAccText(g, lh, lr, disabledForeground,
paintArrowIcon(g, lh, lr, foreground); acceleratorSelectionForeground,
acceleratorForeground);
SwingUtilities3.paintArrowIcon(g, lh, lr, foreground);
// Restore original graphics font and color // Restore original graphics font and color
g.setColor(holdc); g.setColor(holdc);