Skip to content

Commit

Permalink
Extend to Windows11 and later
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Feb 13, 2025
1 parent 46a1cb5 commit 7fac9e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,8 @@ protected void paintMenuItem(Graphics g, JComponent c,
paintCheckIcon(g, lh, lr, holdc, foreground);
paintIcon(g, lh, lr, holdc);
if (UIManager.getLookAndFeel().getName().equals("Windows")
&& System.getProperty("os.name").equals("Windows 11")
&& (Integer.parseInt(System.getProperty("os.name").
replaceAll("[^0-9]", "")) >= 11)
&& lh.getCheckIcon() != null && lh.useCheckAndArrow()) {
Rectangle rect = lr.getTextRect();
if (menuItem.getIcon() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,8 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
assert menuItem == null || c == menuItem;
Icon icon = getIcon();
int skinWidth = -1;
boolean isWindows11 = System.getProperty("os.name").
equals("Windows 11");
boolean isWindows11OrLater = Integer.parseInt(System.getProperty("os.name").
replaceAll("[^0-9]", "")) >= 11;
if (type == JCheckBoxMenuItem.class
|| type == JRadioButtonMenuItem.class) {
AbstractButton b = (AbstractButton) c;
Expand All @@ -876,7 +876,7 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
if (xp != null) {
Skin skin;
skin = xp.getSkin(c, backgroundPart);
if (!isWindows11) {
if (!isWindows11OrLater) {
skin.paintSkin(g, x, y,
getIconWidth(), getIconHeight(), backgroundState);
if (icon == null) {
Expand All @@ -894,7 +894,7 @@ public void paintIcon(Component c, Graphics g, int x, int y) {
}
}
if (icon != null) {
if (!isWindows11) {
if (!isWindows11OrLater) {
icon.paintIcon(c, g, x + OFFSET, y + OFFSET);
} else {
icon.paintIcon(c, g, x - OFFSET +
Expand Down

0 comments on commit 7fac9e0

Please sign in to comment.