Results 1 to 4 of 4

Thread: Appropriate keyboard accelerator for Mac OS

  1. #1
    Join Date
    Oct 2006
    Posts
    3

    Default 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,
    Kurt

  2. #2
    Join Date
    Oct 2006
    Posts
    3

    Default

    There seems to be a solution, but it have to integrated into the framework. Apple provide an example here: http://developer.apple.com/samplecod.../listing2.html

  3. #3
    Join Date
    May 2005
    Posts
    394

    Default

    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. #4
    Join Date
    Oct 2006
    Posts
    3

    Default

    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
    Code:
    JMenuItem jmi = new JMenuItem("Copy"); 
    jmi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •