How are Mnemonics On Buttons Supposed To Work?

Richard Bair richard.bair at oracle.com
Mon Jul 1 14:25:26 PDT 2013


This is correct, Apple doesn't (typically? ever?) display mnemonics on Mac. We want our behavior here to be consistent with the OS.

Richard

On Jul 1, 2013, at 1:41 PM, Mark Fortner <phidias51 at gmail.com> wrote:

> Hi John,
> Yes, I am using OS X. Thanks for the link.   I ended up creating a window
> level key listener to listen for single key press events (don't really need
> a modifier).  I'll have to rethink my approach.
> 
> It would be nice if there was a note in the javadoc about this.
> 
> Regards,
> Mark
> 
> Cheers,
> 
> Mark
> 
> 
> 
> On Mon, Jul 1, 2013 at 1:29 PM, John Smith <John_Smith at symantec.com> wrote:
> 
>> Are you using OS X?
>> 
>> For me, mnemonics in JavaFX work on Windows, but not at all in OS X (which
>> is perhaps by undocumented design?).
>> 
>> Apple's platform integration guide contains a section on Mnemonics, it
>> based on Swing but I think the concepts translate to JavaFX:
>> 
>> https://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html
>> 
>>> The JMenuItem class inherits the concept of mnemonics from the
>> JAbstractButton class. In the context of menus, mnemonics are shortcuts to
>> menus and their contents, which are executed by using a modifier key in
>> conjunction with a single letter. When you set a mnemonic in a menu item,
>> Java underscores the mnemonic letter in the title of the JMenuItem or JMenu
>> component when the Option key is held down. Using mnemonics is discouraged
>> in OS X, because mnemonics violate the principles of OS X Human Interface
>> Guidelines. If you are developing a Java application for multiple platforms
>> and some of those platforms recommend the use of mnemonics, just include a
>> single setMnemonics() method that is conditionally called (based on the
>> platform) when constructing your interface.
>>> 
>>> How then do you get the functionality of mnemonics without using Java's
>> mnemonics? If you have defined a keystroke sequence in the setAccelerator()
>> method for a menu item, that key sequence is automatically entered into
>> your menus.
>> 
>> Accelerators work on both Windows and OS X (
>> http://stackoverflow.com/questions/12710468/using-javafx-2-2-mnemonic).
>> 
>> -----Original Message-----
>> From: openjfx-dev-bounces at openjdk.java.net [mailto:
>> openjfx-dev-bounces at openjdk.java.net] On Behalf Of Mark Fortner
>> Sent: Monday, July 01, 2013 10:35 AM
>> To: openjfx-dev at openjdk.java.net
>> Subject: How are Mnemonics On Buttons Supposed To Work?
>> 
>> Recently, I added mnemonics to some buttons and enabled mnemonic parsing,
>> and noticed that the mnemonic isn't rendered.  I came across this issue:
>> https://javafx-jira.kenai.com/browse/RT-18849
>> 
>> which seems to indicate that NOT showing mnemonics is the expected
>> behavior.
>> 
>> If that's correct, how are user's supposed to know what mnemonics are
>> available?
>> 
>> 
>> Cheers,
>> 
>> Mark
>> 



More information about the openjfx-dev mailing list