com.virtuosotechnologies.lib.platform
Class PlatformUtils

java.lang.Object
  extended bycom.virtuosotechnologies.lib.platform.PlatformUtils

public final class PlatformUtils
extends Object

Utilities for dealing with cross-platform issues.


Field Summary
static String[] DEFAULT_PROVIDERNAMES
          An array of provider names that the initialize() method will attempt to install by default.
static String MAC_OS_X_PROVIDERNAME
          Name of the Mac OS X PlatformProvider
static PlatformEvent.Type OPEN_ABOUTBOX_EVENT
          Event type for open about box.
static PlatformEvent.Type OPEN_HELP_EVENT
          Event type for open help.
static PlatformEvent.Type OPEN_PREFERENCES_EVENT
          Event type for open preferences.
static PlatformEvent.Type QUIT_EVENT
          Event type for request quit.
 
Method Summary
static void initialize()
          Initialize the platform mechanism, adding all the default providers specified by DEFAULT_PROVIDERNAMES.
static boolean isSystemPreferencesMenuItemEnabled()
          Returns true if there is a system-provided "Preferences" menu item and it is enabled.
static boolean isUsingMacOSXScreenMenuBar()
          Returns true if swing menu bars are currently being merged into the Mac OS X screen-wide menu bar.
static boolean setSystemPreferencesMenuItemEnabled(boolean enabled)
          Enable or disable the system-provided "Preferences" menu item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUIT_EVENT

public static final PlatformEvent.Type QUIT_EVENT
Event type for request quit.


OPEN_ABOUTBOX_EVENT

public static final PlatformEvent.Type OPEN_ABOUTBOX_EVENT
Event type for open about box.


OPEN_PREFERENCES_EVENT

public static final PlatformEvent.Type OPEN_PREFERENCES_EVENT
Event type for open preferences.


OPEN_HELP_EVENT

public static final PlatformEvent.Type OPEN_HELP_EVENT
Event type for open help.


MAC_OS_X_PROVIDERNAME

public static final String MAC_OS_X_PROVIDERNAME
Name of the Mac OS X PlatformProvider

See Also:
Constant Field Values

DEFAULT_PROVIDERNAMES

public static final String[] DEFAULT_PROVIDERNAMES
An array of provider names that the initialize() method will attempt to install by default. Note that this does not mean these providers will actually be installed, because the platform may not match, or because the provider may not actually be present.

Method Detail

initialize

public static void initialize()
Initialize the platform mechanism, adding all the default providers specified by DEFAULT_PROVIDERNAMES. This should be called once at program startup. Note that this does not mean these providers will actually be installed, because the platform may not match, or because the provider may not actually be present.


isUsingMacOSXScreenMenuBar

public static boolean isUsingMacOSXScreenMenuBar()
Returns true if swing menu bars are currently being merged into the Mac OS X screen-wide menu bar. If this is the case, a system menu is present that automatically provides "About", "Preferences" and "Quit" items, among others. In this case, the program should generally not provide those facilities itself.

Returns:
true if using the screen menu bar

isSystemPreferencesMenuItemEnabled

public static boolean isSystemPreferencesMenuItemEnabled()
Returns true if there is a system-provided "Preferences" menu item and it is enabled.

Returns:
true if system-provided "Preferences" is available and enabled

setSystemPreferencesMenuItemEnabled

public static boolean setSystemPreferencesMenuItemEnabled(boolean enabled)
Enable or disable the system-provided "Preferences" menu item.

Parameters:
enabled - true to enable
Returns:
true if successful, or false if there is no system-provided "Preferences" menu item.