<Swing Dev> [8] Review request for 7156657 Version 7 doesn't support translucent popup menus against a translucent window

Pavel Porvatov pavel.porvatov at oracle.com
Wed Jun 6 14:57:42 UTC 2012

Hi Anthony,
> On 6/6/2012 5:05 PM, Pavel Porvatov wrote:
>>> I don't understand why this change is necessary. The current code 
>>> simply detects if a window is non-opaque and forces HW popups for 
>>> such windows. This works automatically and is very useful.
>> Yes, it's very useful but produces the regression that described in 
>> CR 7156657.
>>> With this fix, however, most developers who use translucent windows, 
>>> will have to manually call setLightWeightPopupEnabled(false), which 
>>> doesn't look developer-friendly. Also, it changes the current 
>>> behavior causing a regression.
>> Current behavior contains a regression from older release jdk6, so 
>> reverting fix of CR 7027486 (JPopupMenu doesn't take window shape 
>> into account) doesn't look like a regression.
> Given that the current behavior exists since 7 GA, this will be a 
> regression, too. So, all in all, we're discussing two regressions here.
>>> Instead of changing our own demo code and affecting developers who 
>>> might have already relied on the current behavior, why not simply 
>>> suggest the submitters of 7156657 to force LW popups for their 
>>> specific use case?
>> Unfortunately there is no way to force LW popups, so there is no 
>> workaround for the problem
> I see. Did you consider introducing such possibility?
> E.g. we could leave the behavior introduced with 7027486 as is, and 
> only turn it off when a system property is specified. This would 
> resolve the issue reported by the submitter, and at the same time 
> would preserve the useful behavior we have since the 1.7.0 release.
Actually I don't like idea to introduce new system properties or new API 
in this case because of the following reasons:
1. More compact API looks better. In suggested fix there is only 
setLightWeightPopupEnabled method and it covers all use cases.
2. Fix of CR 7027486 (JPopupMenu doesn't take window shape into account) 
breaks very old behavior of the 
javax.swing.JPopupMenu#setLightWeightPopupEnabled method: after the fix 
light weight popups become heavy weight (for translucent and shaped windows)
3. If we implement the fix as you suggested then we should add in 
javadoc something like this: "setLightWeightPopupEnabled doesn't work in 
some cases (for translucent and shaped window). For fix that you must 
set 'blablabla' system property"... =)
4. We can add system property that will force heavy weight for the 
application later. I'd prefer to don't introduce such property unless 
somebody ask about that.

Regards, Pavel
> -- 
> best regards,
> Anthony
>> Regards, Pavel
>>> -- 
>>> best regards,
>>> Anthony
>>> On 6/6/2012 3:08 PM, Pavel Porvatov wrote:
>>>> Hello,
>>>> Please review a fix for the following issue:
>>>>   7156657 Version 7 doesn't support translucent popup menus against 
>>>> a translucent window
>>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7156657
>>>> The webrev is here: http://cr.openjdk.java.net/~rupashka/7156657/ 
>>>> <http://cr.openjdk.java.net/%7Erupashka/7156657/>
>>>> The fix of CR 7027486 (JPopupMenu doesn't take window shape into 
>>>> account, http://hg.openjdk.java.net/jdk8/awt/jdk/rev/9024198193ce) 
>>>> doesn't take into account that some users use translucent windows 
>>>> with translucent menus. After discussions the following decision 
>>>> was made:
>>>> 1. When JPopupMenu#setLightWeightPopupEnabled is set to false 
>>>> HEAVY_WEIGHT popups is used (instead of MEDIUM_WEIGHT). This fix 
>>>> was done in CR 6800513 (GTK-LaF renders menus incompletely, 
>>>> http://hg.openjdk.java.net/jdk8/awt/jdk/rev/cd00d68e06ac and 
>>>> http://hg.openjdk.java.net/jdk8/awt/jdk/rev/8800a98316b2) and that 
>>>> allows to use non-translucent and non-clipped popups for 
>>>> translucent or shaped windows
>>>> 2. Fix of CR 7027486 should be reverted
>>>> 3. The TransparentRuler should be corrected according new fix
>>>> Regards,
>>>> Pavel.

More information about the swing-dev mailing list