Class OSXSupport

java.lang.Object
org.vanted.osx.OSXSupport

public class OSXSupport
extends Object
Handles Mac OS X specific stuff.
Author:
Johan Kaving
  • Field Details

  • Constructor Details

    • OSXSupport

      public OSXSupport()
  • Method Details

    • initializeMacOSX

      public static void initializeMacOSX​(Action aboutAction, Action quitAction, Action preferencesAction, OpenFileAction openFileAction, Image iconImage, Window fullScreenableWindow)
      Initializes various Mac OS X adaptations, using reflection and proxies in order to be compilable on other platforms.
      Parameters:
      aboutAction - the action to use for the About menu item
      quitAction - the action to use for the Quit menu item
      iconImage - the icon image to use for the dock
      fullScreenableWindow - the window that should be full screen enabled
    • addOSXHandler

      public static void addOSXHandler​(String handlerClassName, String handlerMethodName, String handlerSetterMethodName, Action action)
      Adds an OS X handler to the application
      Parameters:
      handlerClassName - the class name of the handler to add
      handlerMethodName - the name of the method that is called on the handler when invoked
      handlerSetterMethodName - the name of the method used to set the handler
      action - the action to perform when the handler is invoked
    • getOSXApplication

      public static Object getOSXApplication()
      Get an Apple eAWT Application object
      Returns:
      an Application object
    • isOSX

      public static boolean isOSX()
      Determine whether we are running on MAC OS X or not
      Returns:
      true if is running on MAC OS X
    • hasOSXFullScreenSupport

      public static boolean hasOSXFullScreenSupport()
      Mac OS X Lion full screen support was added in Java for Mac OS X 10.7 Update 1 and 10.6 Update 6. This determines whether we are running on a version with Lion full screen support. Which Java version corresponds to which Java for Mac OS X update can be found in Apple's: "Technical Note TN2110 - Identifying Java on Mac OS X"
      Returns:
      true if we are running on OS X with the new eAWT
      See Also:
      Technical Note TN2110
    • mapCtrlModifier

      public static int mapCtrlModifier()
      Maps CTRL modifier to default Command (Apple) modifier key. Most often usage is regarding conflicting bindings.
      Returns:
      modifier depending on current OS
    • getMappedCtrlModifierText

      public static String getMappedCtrlModifierText()
      Gets the textual representation of the mapped CTRL modifier.
      Returns:
      String for CTRL or Command key.
      See Also:
      mapCtrlModifier()