<Swing Dev> RFR: 8075915: The eight controls without black backgrounds with WinLAF & GTK LAF & Nimbus LAF [v3]
Alexander Zvegintsev
azvegint at openjdk.java.net
Thu Apr 15 13:21:35 UTC 2021
On Thu, 15 Apr 2021 09:39:12 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Alexander Zvegintsev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> allow to run it with different L&F
>
> test/jdk/javax/swing/JCheckBox/4449413/bug4449413.java line 191:
>
>> 189: };
>> 190:
>> 191: b.setOpaque(true);
>
> Any reason why this setOpaque was added? I am of the opinion that it should get controlled either by LookAndFeel.installProperty or by component's constructor.
The reason is in `JComponent#setBackground()` [javadoc](https://docs.oracle.com/en/java/javase/15/docs/api/java.desktop/javax/swing/JComponent.html#setBackground(java.awt.Color))
> Sets the background color of this component. The background color is used only if the component is opaque, and only by subclasses of JComponent or ComponentUI implementations. Direct subclasses of JComponent must override paintComponent to honor this property.
>
> It is up to the look and feel to honor this property, some may choose to ignore it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3474
More information about the swing-dev
mailing list