8271923: [macos] the text color on the selected disabled tabbed pane button remains white making text unreadable

Reviewed-by: jdv
This commit is contained in:
Prasanta Sadhukhan 2021-09-07 15:50:27 +00:00
parent 2abf3b3b27
commit df05b4d1a1
2 changed files with 9 additions and 1 deletions
src/java.desktop/macosx/classes/com/apple/laf

@ -328,6 +328,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
final ColorUIResource selectedTabTitlePressedColor = new ColorUIResource(240, 240, 240);
final ColorUIResource selectedTabTitleDisabledColor = new ColorUIResource(new Color(1, 1, 1, 0.55f));
final ColorUIResource selectedTabTitleNonFocusColor = black;
final ColorUIResource selectedTabTitleNormalColor = white;
final Color selectedControlTextColor = AquaImageFactory.getSelectedControlColorUIResource();
final ColorUIResource selectedTabTitleShadowDisabledColor = new ColorUIResource(new Color(0, 0, 0, 0.25f));
@ -871,6 +872,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
"TabbedPane.tabsOverlapBorder", Boolean.TRUE,
"TabbedPane.selectedTabTitlePressedColor", selectedTabTitlePressedColor,
"TabbedPane.selectedTabTitleDisabledColor", selectedTabTitleDisabledColor,
"TabbedPane.selectedTabTitleNonFocusColor", selectedTabTitleNonFocusColor,
"TabbedPane.selectedTabTitleNormalColor", JRSUIUtils.isMacOSXBigSurOrAbove() ? selectedControlTextColor : selectedTabTitleNormalColor,
"TabbedPane.selectedTabTitleShadowDisabledColor", selectedTabTitleShadowDisabledColor,
"TabbedPane.selectedTabTitleShadowNormalColor", selectedTabTitleShadowNormalColor,

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,9 +38,12 @@ import javax.swing.text.View;
import sun.swing.SwingUtilities2;
import apple.laf.JRSUIUtils;
import apple.laf.JRSUIConstants.*;
public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
private static boolean isFrameActive = false;
public static ComponentUI createUI(final JComponent c) {
return new AquaTabbedPaneContrastUI();
}
@ -79,6 +82,8 @@ public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor");
} else if (!enabled) {
return UIManager.getColor("TabbedPane.selectedTabTitleDisabledColor");
} else if (!JRSUIUtils.isMacOSXBigSurOrAbove() && !isFrameActive) {
return UIManager.getColor("TabbedPane.selectedTabTitleNonFocusColor");
} else {
return UIManager.getColor("TabbedPane.selectedTabTitleNormalColor");
}
@ -101,6 +106,7 @@ public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
}
protected State getState(final int index, final boolean frameActive, final boolean isSelected) {
isFrameActive = frameActive;;
if (!frameActive) return State.INACTIVE;
if (!tabPane.isEnabled()) return State.DISABLED;
if (pressedTab == index) return State.PRESSED;