Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8271923: [macos] the text color on the selected disabled tabbed pane …
…button remains white making text unreadable

Reviewed-by: jdv
  • Loading branch information
prsadhuk committed Sep 7, 2021
1 parent 2abf3b3 commit df05b4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -328,6 +328,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 selectedTabTitleNonFocusColor = black;
final ColorUIResource selectedTabTitleNormalColor = white;
final Color selectedControlTextColor = AquaImageFactory.getSelectedControlColorUIResource();
final ColorUIResource selectedTabTitleShadowDisabledColor = new ColorUIResource(new Color(0, 0, 0, 0.25f));
Expand Down Expand Up @@ -871,6 +872,7 @@ public Object createValue(UIDefaults defaultsTable) {
"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,
Expand Down
@@ -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
Expand Down Expand Up @@ -38,9 +38,12 @@

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();
}
Expand Down Expand Up @@ -79,6 +82,8 @@ protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed
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");
}
Expand All @@ -101,6 +106,7 @@ protected boolean shouldRepaintSelectedTabOnMouseDown() {
}

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;
Expand Down

1 comment on commit df05b4d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.