<Swing Dev> A proposal for a behavior change about mnemonic key
zhouyx at linux.vnet.ibm.com
Sun Nov 6 19:28:54 PST 2011
Sorry for this reply to be late. I agree with you. However, I don't think
java supports so much.
Given gtk nautilaus as an example, when "alt+f" opens the File menu, press
"alt+e" will not
open Edit menu. "Esc" is required before "alt+e". If java uses gtk
behavior for gtk l&f and
change a behavior for default swing l&f, it may be too complicated.
PS. I just created a bug for requesting the feature. It is
I'll make a webrev according to Pavel's suggestion in previous
On Sat, Oct 8, 2011 at 11:38 PM, neugens.limasoftware at gmail.com <
neugens.limasoftware at gmail.com> wrote:
> I believe that native look and feel should mandate the different
> keybindings, the cross platform look and feel should behave in a specified
> way, that doesn't need to be necessarily the same as the underlying
> platform, although this should be user configurable in a property though
> (perhaps saved in the preferences), because it's indeed an area if great
> confusion for the users.
> ----- Reply message -----
> Da: "Pavel Porvatov" <pavel.porvatov at oracle.com>
> Data: sab, ott 8, 2011 04:35
> Oggetto: <Swing Dev> A proposal for a behavior change about mnemonic key
> A: <zhouyx at linux.vnet.ibm.com>
> Cc: "swing-dev at openjdk.java.net" <swing-dev at openjdk.java.net>
> Hi Sean,
> > Hi Pavel,
> > Your observation is right, but I can't agree with the conclusion.
> > Windows and
> > GTK behave differently about how to close an opened menu. Under GTK,
> > "alt" can not close an opened menu, so, the "esc" is used to close it;
> > while
> > windows performs more friendly, when mnemonic key is pressed again,
> > the first
> > opened menu is closed automatically. This is totally about how to
> > close an
> > opened menu, and it doesn't change the fact that menus with same mnemonic
> > key are iterated.
> > On the other side, swing implementation doesn't follow GTK's
> > behavior about
> > how to close the menu at all. Open the swingset2 and you can find its
> > behavior
> > is the same with windows. Press "alt+f" and then press "alt+l" will
> > open the
> > "look and feel" menu instead of GTK's "alt+f", "esc", and "alt+l".
> > So, I think GTK's behavior about "use esc to close an opened menu"
> > is not
> > user friendly and we can ignore it, while GTK's "iterate over menus
> > with same
> > mnemonic key" is better than current java implementation and we can add
> > this feature. And if a user wants to use GTK's key sequence "alt+f",
> > "esc",
> > "alt+l", it is also functional.
> > So I think this enhancement will help keep the behavior same with
> > both these
> > platforms, how do you think?
> Sounds reasonable and I don't object now to the decision. Does anybody
> have ideas (e.g. objections) about the new functionality?
> I glanced at your patch and have the following comments:
> 1. Could you please file CR about the problem
> 2. A test is needed (I think it's possible to write an automatic one)
> 3. Could you please correct the new code to obey our code standards
> (aligning, spacing, mandatory braces in if/else conditions and others)
> If possible send patch as a webrev, please.
> Thanks, Pavel
> > 2011/9/21 Pavel Porvatov <pavel.porvatov at oracle.com
> > <mailto:pavel.porvatov at oracle.com>>
> > Hi Sean,
> > I found out that Windows and GTK works in different ways (I used
> > your apps):
> > 1. When Alt+i is pressed several times:
> > In Windows focus moves between items
> > In Ubuntu focus stays at the initially selected item
> > 2. When sequence Alt+i and Escape pressed several times
> > In Windows the first menu item is selected
> > In Ubuntu after every sequence the next item is selected
> > In such case we should use different strategies for different
> > platforms...
> > Regards, Pavel
> >> Hi Pavel,
> >> I just tested linux gtk platform. With gtk2+, ubuntu linux
> >> with kernel 2.6.38, xfce, x86_32.
> >> I set four menus with mnemonic "i". Press "alt+i" will travel
> >> through four menus. The difference
> >> is that each menu must be closed with "esc" before "alt+i" opens
> >> the next one.
> >> So press "alt+i" opens "File", and press "esc" to close it;
> >> then press "alt+i" opens "Edit", and press "esc" to close it;
> >> ... for next menu with mnemonic "i"
> >> I attached the test application and its ui file. If it is
> >> blocked, please use
> >> this link:
> >> <
> >> Ubuntu x86_32 should work.
> >> So, I think both windows and linux gtk have supported traversal
> >> of same mnemonic keyed
> >> items already.
> >> 2011/9/14 Pavel Porvatov <pavel.porvatov at oracle.com
> >> <mailto:pavel.porvatov at oracle.com>>
> >> Hi Sean,
> >>> Hi Pavel,
> >>> Let's see if this time works. The attachement just
> >>> contains the exe file written by C#, the application is very
> >>> simple, I just drag a menu to the default WinForm in VS2003.
> >>> Please change the extension from exe1 to exe after unzip
> >>> as gmail doesn't allow exe file to be sent.
> >> Yes, I see. And what about other platforms/lafs? Your patch
> >> affects behavior of all lafs. So we must be sure, that such
> >> behavior is correct for every supported platform...
> >> Regards, Pavel
> >>> 2011/9/13 Pavel Porvatov <pavel.porvatov at oracle.com
> >>> <mailto:pavel.porvatov at oracle.com>>
> >>> Hi Sean,
> >>> I think the attached sample was removed because I didn't
> >>> get any attachments...
> >>> Regards, Pavel
> >>>> Hi Pavel,
> >>>> I found C# Form application treats Mnemonics in menu
> >>>> in this way. I attached the sample
> >>>> application. Press alt+i will iterate over three menu.
> >>>> 2011/9/13 Pavel Porvatov <pavel.porvatov at oracle.com
> >>>> <mailto:pavel.porvatov at oracle.com>>
> >>>> Hi Sean,
> >>>>> Hi,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swing-dev