Skip to content
Permalink
Browse files
8251377: [macos11] JTabbedPane selected tab text is barely legible
Reviewed-by: shade
Backport-of: 3f67afd
  • Loading branch information
TheRealMDoerr committed Sep 2, 2021
1 parent 9a5ba0b commit ea1a1d86b92e43bbb4ecadf4ba3bd338b3441ad4
@@ -36,6 +36,16 @@

static boolean isLeopard = isMacOSXLeopard();
static boolean isSnowLeopardOrBelow = isMacOSXSnowLeopardOrBelow();
static boolean isCatalinaOrAbove = isMacOSXCatalinaOrAbove();
static boolean isBigSurOrAbove = isMacOSXBigSurOrAbove();

public static boolean isMacOSXBigSurOrAbove() {
return currentMacOSXVersionMatchesGivenVersionRange(16, true, false, true);
}

static boolean isMacOSXCatalinaOrAbove() {
return currentMacOSXVersionMatchesGivenVersionRange(15, true, false, true);
}

static boolean isMacOSXLeopard() {
return isCurrentMacOSXVersion(5);
@@ -496,4 +496,8 @@ public static Color getSelectionInactiveBackgroundColorUIResource() {
public static Color getSelectionInactiveForegroundColorUIResource() {
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
}

public static Color getSelectedControlColorUIResource() {
return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.SELECTED_CONTROL_TEXT_COLOR));
}
}
@@ -307,6 +307,7 @@ public Object createValue(UIDefaults defaultsTable) {
final ColorUIResource selectedTabTitlePressedColor = new ColorUIResource(240, 240, 240);
final ColorUIResource selectedTabTitleDisabledColor = new ColorUIResource(new Color(1, 1, 1, 0.55f));
final ColorUIResource selectedTabTitleNormalColor = white;
final Color selectedControlTextColor = AquaImageFactory.getSelectedControlColorUIResource();
final ColorUIResource selectedTabTitleShadowDisabledColor = new ColorUIResource(new Color(0, 0, 0, 0.25f));
final ColorUIResource selectedTabTitleShadowNormalColor = mediumTranslucentBlack;
final ColorUIResource nonSelectedTabTitleNormalColor = black;
@@ -848,7 +849,7 @@ public Object createValue(UIDefaults defaultsTable) {
"TabbedPane.tabsOverlapBorder", Boolean.TRUE,
"TabbedPane.selectedTabTitlePressedColor", selectedTabTitlePressedColor,
"TabbedPane.selectedTabTitleDisabledColor", selectedTabTitleDisabledColor,
"TabbedPane.selectedTabTitleNormalColor", selectedTabTitleNormalColor,
"TabbedPane.selectedTabTitleNormalColor", JRSUIUtils.isMacOSXBigSurOrAbove() ? selectedControlTextColor : selectedTabTitleNormalColor,
"TabbedPane.selectedTabTitleShadowDisabledColor", selectedTabTitleShadowDisabledColor,
"TabbedPane.selectedTabTitleShadowNormalColor", selectedTabTitleShadowNormalColor,
"TabbedPane.nonSelectedTabTitleNormalColor", nonSelectedTabTitleNormalColor,
@@ -196,14 +196,16 @@ public LWCToolkit() {
/*
* System colors with default initial values, overwritten by toolkit if system values differ and are available.
*/
private static final int NUM_APPLE_COLORS = 3;
private static final int NUM_APPLE_COLORS = 4;
public static final int KEYBOARD_FOCUS_COLOR = 0;
public static final int INACTIVE_SELECTION_BACKGROUND_COLOR = 1;
public static final int INACTIVE_SELECTION_FOREGROUND_COLOR = 2;
public static final int SELECTED_CONTROL_TEXT_COLOR = 3;
private static int[] appleColors = {
0xFF808080, // keyboardFocusColor = Color.gray;
0xFFC0C0C0, // secondarySelectedControlColor
0xFF303030, // controlDarkShadowColor
0xFFFFFFFF, // controlTextColor
};

private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
@@ -119,6 +119,7 @@ + (void)reloadColors {
appleColors[sun_lwawt_macosx_LWCToolkit_KEYBOARD_FOCUS_COLOR] = [NSColor keyboardFocusIndicatorColor];
appleColors[sun_lwawt_macosx_LWCToolkit_INACTIVE_SELECTION_BACKGROUND_COLOR] = [NSColor secondarySelectedControlColor];
appleColors[sun_lwawt_macosx_LWCToolkit_INACTIVE_SELECTION_FOREGROUND_COLOR] = [NSColor controlDarkShadowColor];
appleColors[sun_lwawt_macosx_LWCToolkit_SELECTED_CONTROL_TEXT_COLOR] = [NSColor controlTextColor];

for (i = 0; i < sun_lwawt_macosx_LWCToolkit_NUM_APPLE_COLORS; i++) {
[appleColors[i] retain];

1 comment on commit ea1a1d8

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on ea1a1d8 Sep 2, 2021

Please sign in to comment.