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

Semyon Sadetsky semyon.sadetsky at oracle.com
Thu Nov 24 17:42:44 UTC 2016



On 24.11.2016 20:25, Sergey Bylokhov wrote:
> On 24.11.16 19:54, Semyon Sadetsky wrote:
>> "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.
>
> It have a different implementations because it has different meaning:
>  - The non-opaque window is a window which uses transparent background.
>  - The non-opaque component is the component which require the parents 
> be painted first. it is not necessary that the background in this case 
> should be transparent(It is possible that the component draw something 
> only in some place of its bounds) And transparent color is not always 
> requires that the component should be non-opaque, because components 
> can ignore its background.
Hmm.. Both JComponent and Window override the same Component.isOpaque() 
but the property has different meaning for each of them.
Probably, this is a design mistake?



More information about the swing-dev mailing list