<Swing Dev> RFR: 8251377: [macos11] JTabbedPane selected tab text is barely legible

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Nov 19 10:55:06 UTC 2020


On Thu, 19 Nov 2020 08:29:11 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> On macOS 11 (bigsur) beta, using the Swing Aqua Look and Feel, the text of the selected JTabbedPane tab title text is just a light gray outline of white text on a white background. The macOS 11 design inverted from dark background / light text to light background / dark text, 
>> Proposed fix is to use dark color in light background so I used lightGray instead of "white" which is being used now, if we are on BigSur.
>
> I have tried to test this change on macOS 10.15 and found some differences from the old behavior.
> Before the fix:
>  - The color was white for the selected tab while the window was focused, the same as in the native app(I have tested the tabs in the System preferences->Displays). So it worked fine.
>  - The color was white for the selected tab while the window was unfocused(some other app is in focus). This is different from the native app, which uses black color. So this is a bug.
> 
> After the fix:
>  - The color is "blurred white" or even "light blue" for the selected tab while the window is focused.
>  - The color is "light blue" for the selected tab while the window is unfocused.
> 
> I think the new color used in the fix can be configured in the System Preferences -> General -> Highlight Color. If I select the green color then the tabs start to use green as a font color, which looks incorrect.

In Mohave, native System Preferences->Display tabs has 
white-text-on-blue-background when windows is focused
black-text-on-lightgray-background when window is unfocused

In macos11, it is always black-text-on-white-background whether focused/unfocused.

Current JDK tabpane always shows black background (when tab is selected) which is not configurable, at least I could not change it. Only thing i could change is the foreground text color. 
As was told to get color from native, I could see only "selectedTextBackground" and "selectedControlColor" works on both pre-macos11 and macos11 as it gives bluish text color which is legible on black (mohave) and white (macos11) background.

All other native-obtained-colors like selectedTextColor, selectedControlTextColor, controlTextColor, textBackgroundColor either gives black or white which is not legible on either pre-macos11 or macos11, so was not used.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1182


More information about the swing-dev mailing list