<Swing Dev> [9] Review request for 8027639: JComboBox's popup leaves tracks after closing

Semyon Sadetsky semyon.sadetsky at oracle.com
Thu Nov 24 16:54:34 UTC 2016


On 24.11.2016 18:33, Alan Snyder wrote:

>
>> On Nov 24, 2016, at 7:18 AM, Semyon Sadetsky 
>> <semyon.sadetsky at oracle.com <mailto:semyon.sadetsky at oracle.com>> wrote:
>>
>>> If someone(in the application) change the background to transparent 
>>> color then it should change opaque state as well.
>> Can you prove this statement at least with a reference to spec? It 
>> seems JComponent does not imply this.
>
> The spec could be clearer with regard to painting a translucent color, 
> but the implication is clear from the term “show through”. Painting a 
> translucent color allows the pixels underneath to show through, so the 
> components that provided those pixels must be repainted.
"A non-opaque component paints only a subset of its pixels or none at 
all...". Per-pixel translucent component paints all its pixels. This is 
not clearly states that per-pixel translucent component shall be non-opaque.
I see an obvious inconsistency in a way we handle translucent JComponent 
and Window. This, of cause, need to be resolved somehow. We could 
forcibly make JComponent to be non-opaque as well as this is done for 
Window, or take translucency into account during the painting.

The Window#isOpaque() spec states:

The method returns false if the background color of the window
is not null and the alpha component of the color is less than 1.0.

Even with this absolutely clear spec the opaque property is set to false 
automatically with assigning transparent background to the window, and 
it doesn't require from user to keep them consistent.

>
>
> public boolean isOpaque()
> Returns true if this component is completely opaque.
>
> An opaque component paints every pixel within its rectangular bounds. 
> A non-opaque component paints only a subset of its pixels or none at 
> all, allowing the pixels underneath it to "show through". Therefore, a 
> component that does not fully paint its pixels provides a degree of 
> transparency.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20161124/0a7cc338/attachment.html>


More information about the swing-dev mailing list