Skip to content

Commit df05b4d

Browse files
committed
8271923: [macos] the text color on the selected disabled tabbed pane button remains white making text unreadable
Reviewed-by: jdv
1 parent 2abf3b3 commit df05b4d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ public Object createValue(UIDefaults defaultsTable) {
328328

329329
final ColorUIResource selectedTabTitlePressedColor = new ColorUIResource(240, 240, 240);
330330
final ColorUIResource selectedTabTitleDisabledColor = new ColorUIResource(new Color(1, 1, 1, 0.55f));
331+
final ColorUIResource selectedTabTitleNonFocusColor = black;
331332
final ColorUIResource selectedTabTitleNormalColor = white;
332333
final Color selectedControlTextColor = AquaImageFactory.getSelectedControlColorUIResource();
333334
final ColorUIResource selectedTabTitleShadowDisabledColor = new ColorUIResource(new Color(0, 0, 0, 0.25f));
@@ -871,6 +872,7 @@ public Object createValue(UIDefaults defaultsTable) {
871872
"TabbedPane.tabsOverlapBorder", Boolean.TRUE,
872873
"TabbedPane.selectedTabTitlePressedColor", selectedTabTitlePressedColor,
873874
"TabbedPane.selectedTabTitleDisabledColor", selectedTabTitleDisabledColor,
875+
"TabbedPane.selectedTabTitleNonFocusColor", selectedTabTitleNonFocusColor,
874876
"TabbedPane.selectedTabTitleNormalColor", JRSUIUtils.isMacOSXBigSurOrAbove() ? selectedControlTextColor : selectedTabTitleNormalColor,
875877
"TabbedPane.selectedTabTitleShadowDisabledColor", selectedTabTitleShadowDisabledColor,
876878
"TabbedPane.selectedTabTitleShadowNormalColor", selectedTabTitleShadowNormalColor,

src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneContrastUI.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,9 +38,12 @@
3838

3939
import sun.swing.SwingUtilities2;
4040

41+
import apple.laf.JRSUIUtils;
4142
import apple.laf.JRSUIConstants.*;
4243

4344
public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
45+
private static boolean isFrameActive = false;
46+
4447
public static ComponentUI createUI(final JComponent c) {
4548
return new AquaTabbedPaneContrastUI();
4649
}
@@ -79,6 +82,8 @@ protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed
7982
return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor");
8083
} else if (!enabled) {
8184
return UIManager.getColor("TabbedPane.selectedTabTitleDisabledColor");
85+
} else if (!JRSUIUtils.isMacOSXBigSurOrAbove() && !isFrameActive) {
86+
return UIManager.getColor("TabbedPane.selectedTabTitleNonFocusColor");
8287
} else {
8388
return UIManager.getColor("TabbedPane.selectedTabTitleNormalColor");
8489
}
@@ -101,6 +106,7 @@ protected boolean shouldRepaintSelectedTabOnMouseDown() {
101106
}
102107

103108
protected State getState(final int index, final boolean frameActive, final boolean isSelected) {
109+
isFrameActive = frameActive;;
104110
if (!frameActive) return State.INACTIVE;
105111
if (!tabPane.isEnabled()) return State.DISABLED;
106112
if (pressedTab == index) return State.PRESSED;

0 commit comments

Comments
 (0)