RFR: 7188058: Background of TextComponents are not changing colors to the default disabled color when set to uneditable [v2]
Alexey Ivanov
aivanov at openjdk.org
Mon Sep 23 13:17:43 UTC 2024
On Thu, 8 Aug 2024 01:19:55 GMT, Alisen Chung <achung at openjdk.org> wrote:
>> Yes, but as far I could see `TextArea.background` property is being set in
>> `AquaLookAndFeel.java, MotifLookAndFeel.java, BasicLookAndFeel.java, XAWTLookAndFeel.java and WindowsLookAndFeel.java`
>> and this L&F will not be set in AWT environment, if I am not wrong so you will either get garbage or wrong default color if you use UIManager.getColor..so I guess you need to use `TextComponent.getBackground()` which returns SystemColor.control if nothing is set
>
> i've made the change to use TextComponent.getBackground() instead to get the correct background color
AWT components **must not depend on `javax.swing.UIManager`** — pluggable Look and Feels and `UIManager` are features of Swing.
Some AWT components are implemented using lightweight components from Swing, in this case it's appropriate to use `javax.swing` packages but *not in the common code* — in the peers.
As far as I can see, [JDK-7188058](https://bugs.openjdk.org/browse/JDK-7188058) references Linux and macOS only. AWT component on Mac use Swing components; not sure about Linux though.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19876#discussion_r1771403834
More information about the client-libs-dev
mailing list