The Toolkit
method getMenuShortcutKeyMask()
is useful in this context. While the method returns Event.CTRL_MASK
on Windows, it returns Event.META_MASK
on Mac OS X. The resulting mask can be used to construct the KeyStroke
used in a menu item’s setAccelerator()
method.
More Related Contents:
- How do I get a platform-dependent new line character?
- What is the best way to find the user’s home directory in Java?
- How do I monitor the computer’s CPU, memory, and disk usage in Java?
- Is there a way to embed a browser in Java? [closed]
- How to add a shortcut key for a jbutton in java? [closed]
- What is the cross-platform way of obtaining the path to the local application data directory?
- How is Java platform-independent when it needs a JVM to run?
- Platform independent paths in Java
- How do I compile a .java with support for older versions of Java?
- Eclipse Optimize Imports to Include Static Imports
- Is there a way to automatically generate getters and setters in Eclipse?
- Shutting down a computer
- Windows: how to get a list of all visible windows?
- Eclipse comment/uncomment shortcut?
- How can I call .NET code from Java?
- How to add shortcut keys for java code in eclipse
- Running SWT based, cross-platform jar properly on a Mac
- How to atomically rename a file in Java, even if the dest file already exists?
- How do you keep the machine awake?
- How to use the same C++ code for Android and iOS?
- Get ArrayList entry of a HashMap Entry [closed]
- Multiple row selection in JTable
- Java RegEx meta character (.) and ordinary dot?
- Why do these two multiplication operations give different results?
- How to create a Jandex index in Quarkus for classes in a external module
- Is it possible to use the instanceof operator in a switch statement?
- Is there a way to paginate queries by combining query cursors using FirestoreRecyclerAdapter?
- Android: Prompt user to save changes when Back button is pressed
- Can I invoke a java method other than main(String[]) from the command line?
- How do I convert a byte array with null terminating character to a String in Java?