Announcement Announcement Module
No announcement yet.
Appropriate keyboard accelerator for Mac OS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Appropriate keyboard accelerator for Mac OS

    Hi Everybody!

    I'm currently evaluating Spring Rich Client for an upcoming project. So far it seems to help very much. Great thing.

    Our aim is to provide our solution on Win and Mac OS. Everything seems to work fine. But I could find no way to use Mac OS common keyboard accelerator with Spring Rich Client Command Framework in Menus. Is there a solution to show appropriate keyboard accelerator for Mac as well?

    Best Regards,

  • #2
    There seems to be a solution, but it have to integrated into the framework. Apple provide an example here:


    • #3
      That uses apple packages, so will an application that uses those be albe to run on any platform?

      Maybe the JSE 5.0 API has a key that corresponds to something like VK_COMMON_KEYBOARD_ACCELARATOR, which maps to MacOS's keyboard accelarator on Mac platforms?


      • #4
        In one of Apples documentations I found a recommendation:

        Java Development Guide for Mac OS X:

        "Do not set menu item accelerators with an explicit javax.swing.KeyStroke specification. Modifier keys vary from platform to platform. Instead, use java.awt.Tookit.getMenuShortcutKeyMask to ask the system for the appropriate key rather than defining it yourself."

        And a code snippet
        JMenuItem jmi = new JMenuItem("Copy"); 
        jmi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));