Package org.vanted.osx
Class OSXSupport
java.lang.Object
org.vanted.osx.OSXSupport
public class OSXSupport extends Object
Handles Mac OS X specific stuff.
- Author:
- Johan Kaving
-
Field Summary
Fields Modifier and Type Field Description static String
HANDLE_ABOUT
static String
HANDLE_PREFERENCES
static String
HANDLE_QUIT_REQUEST_WITH
static String
OPEN_FILES
-
Constructor Summary
Constructors Constructor Description OSXSupport()
-
Method Summary
Modifier and Type Method Description static void
addOSXHandler(String handlerClassName, String handlerMethodName, String handlerSetterMethodName, Action action)
Adds an OS X handler to the applicationstatic String
getMappedCtrlModifierText()
Gets the textual representation of the mapped CTRL modifier.static Object
getOSXApplication()
Get an Apple eAWT Application objectstatic 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.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.static boolean
isOSX()
Determine whether we are running on MAC OS X or notstatic int
mapCtrlModifier()
Maps CTRL modifier to default Command (Apple) modifier key.
-
Field Details
-
OPEN_FILES
- See Also:
- Constant Field Values
-
HANDLE_PREFERENCES
- See Also:
- Constant Field Values
-
HANDLE_QUIT_REQUEST_WITH
- See Also:
- Constant Field Values
-
HANDLE_ABOUT
- See Also:
- Constant Field Values
-
-
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 itemquitAction
- the action to use for the Quit menu itemiconImage
- the icon image to use for the dockfullScreenableWindow
- 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 addhandlerMethodName
- the name of the method that is called on the handler when invokedhandlerSetterMethodName
- the name of the method used to set the handleraction
- the action to perform when the handler is invoked
-
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
Gets the textual representation of the mapped CTRL modifier.- Returns:
- String for CTRL or Command key.
- See Also:
mapCtrlModifier()
-