Top Inners Fields Constructors Methods
com.sun.glass.ui

public abstract Class Application

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.glass.ui.gtk.GtkApplication, com.sun.glass.ui.ios.IosApplication, com.sun.glass.ui.mac.MacApplication, com.sun.glass.ui.monocle.MonocleApplication, com.sun.glass.ui.win.WinApplication
Imports
com.sun.glass.events.KeyEvent, com.sun.glass.ui.CommonDialogs.ExtensionFilter, .CommonDialogs.FileChooserResult, com.sun.javafx.application.preferences.PreferenceMapping, java.io.File, java.nio.ByteBuffer, .IntBuffer, java.util.List, .Map, .LinkedList, .Optional, java.util.function.Supplier

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static Application
private static final String
private static volatile Map<K, V>
private static final boolean
private Application.EventHandler
private static Thread
private boolean
private String[]
private static boolean
protected String
private static int
private boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract Object
protected abstract int
_getKeyCodeForChar(char c, int hint)

protected abstract void
protected abstract void
protected int
_isKeyLocked(int keyCode)

protected abstract void
private static native void
_overrideNativeWindowHandle(Class<T> lwFrameWrapperClass, Object frame, long handle, Runnable closeWindow)

protected boolean
protected boolean
protected abstract boolean
protected abstract boolean
public static void
checkEventThread()

Verifies that the current thread is the event thread, and throws an exception if this is not so.

public void
checkPlatformPreferencesSupport()

Checks whether there are any problems with platform preferences detection, and if so, emits a warning.

public Accessible
public abstract Cursor
createCursor(int type)

public abstract Cursor
createCursor(int x, int y, Pixels pixels)

public final EventLoop
public final Menu
public final Menu
createMenu(String title, boolean enabled)

public final MenuBar
public final MenuItem
public final MenuItem
public final MenuItem
createMenuItem(String title, MenuItem.Callback callback, int shortcutKey, int shortcutModifiers)

public final MenuItem
createMenuItem(String title, MenuItem.Callback callback, int shortcutKey, int shortcutModifiers, Pixels pixels)

public abstract Pixels
createPixels(int width, int height, ByteBuffer data)

public abstract Pixels
createPixels(int width, int height, ByteBuffer data, float scalex, float scaley)

public abstract Pixels
createPixels(int width, int height, IntBuffer data)

public abstract Pixels
createPixels(int width, int height, IntBuffer data, float scalex, float scaley)

pack-priv static Pixels
createPixels(int width, int height, int[] data, float scalex, float scaley)

public abstract GlassRobot
public abstract Timer
public abstract View
public abstract Window
createWindow(Window owner, Screen screen, int styleMask)

Create a window.

public final Window
createWindow(Screen screen, int styleMask)

Create a window.

pack-priv static Object

Returns:

an object passed to the leaveNestedEventLoop() method
enterNestedEventLoop
()

Starts a nested event loop.

protected void
public static Application
public String

Returns:

the platform specific path for the application data
getDataDirectory
()

Gets a platform specific path that can be used to store application data.

public static Map<K, V>
public Application.EventHandler
protected static Thread
public static int

Returns:

integer code for the given char
getKeyCodeForChar
(char
the character
c
,
int
the code of the key the system is attempting to match
hint
)

Returns a VK_ code of a key capable of producing the given unicode character with respect to the currently active keyboard layout or VK_UNDEFINED if the character isn't present in the current layout.

public String

Returns:

the application name
getName
()

Gets the name for the application.

public Map<String, PreferenceMapping<?, ?>>

Returns:

a map of platform-specific keys to well-known keys
getPlatformKeyMappings
()

Returns a map of platform-specific keys to platform-independent keys defined by JavaFX, including a function that maps the platform-specific value to the platform-independent value.

public Map<String, Class<?>>

Returns:

a map of platform-specific keys to types
getPlatformKeys
()

Returns a mapping of platform-specific keys to the types of their values.

public Map<String, Object>

Returns:

the current set of platform preferences
getPlatformPreferences
()

Returns the current set of platform properties as a map of platform-specific keys to arbitrary values.

pack-priv static float
getScaleFactor(final int x, final int y, final int w, final int h)

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public void
installDefaultMenus(MenuBar menubar)

Install app's default native menus: on Mac OS X - Apple menu (showing the app name) with a single Quit menu item on Windows - NOP on Linux - NOP

public static void
invokeAndWait(Runnable runnable)

Block the current thread and wait until the given runnable finishes running on the native event loop thread.

public static void
invokeLater(Runnable runnable)

Schedule the given runnable to run on the native event loop thread some time in the future, and return immediately.

public static boolean
isEventThread()

Returns true if the current thread is the event thread.

public final Optional<Boolean>
isKeyLocked(int keyCode)

public static boolean
pack-priv static void
leaveNestedEventLoop(Object retValue)

Terminates the current nested event loop.

protected static synchronized void
loadNativeLibrary(final String libname)

protected static synchronized void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
public void
notifyRenderingFinished()

Notifies the Application that rendering has completed for current pulse.

protected void
protected void
protected void
protected void
protected void
protected void
public static void
overrideNativeWindowHandle(Class<T> lwFrameWrapperClass, Object frame, long handle, Runnable closeWindow)

public static void
public static void
run(final Runnable launchable)

protected abstract void
runLoop(Runnable launchable)

public static void
setDeviceDetails(Map<K, V> details)

public void
protected static void
public void
setName(String
the new application name
name
)

Sets the name for the application.

public final void
public final boolean
public boolean
protected abstract CommonDialogs.FileChooserResult
staticCommonDialogs_showFileChooser(Window owner, String folder, String filename, String title, int type, boolean multipleMode, CommonDialogs.ExtensionFilter[] extensionFilters, int defaultFilterIndex)

protected abstract File
protected abstract Size
staticCursor_getBestSize(int width, int height)

protected abstract void
staticCursor_setVisible(boolean visible)

protected abstract int
protected abstract Screen[]
protected abstract double
protected abstract int
protected abstract int
protected abstract int
protected abstract int
protected abstract long
public final boolean
public final boolean
public final boolean
public final boolean
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applicationback to summary
private static Application application
DEFAULT_NAMEback to summary
private static final String DEFAULT_NAME
deviceDetailsback to summary
private static volatile Map<K, V> deviceDetails
disableThreadChecksback to summary
private static final boolean disableThreadChecks
eventHandlerback to summary
private Application.EventHandler eventHandler
eventThreadback to summary
private static Thread eventThread
initialActiveEventReceivedback to summary
private boolean initialActiveEventReceived
initialOpenedFilesback to summary
private String[] initialOpenedFiles
loadedback to summary
private static boolean loaded
nameback to summary
protected String name
nestedEventLoopCounterback to summary
private static int nestedEventLoopCounter
terminateWhenLastWindowClosedback to summary
private boolean terminateWhenLastWindowClosed

Constructor Detail

Applicationback to summary
protected Application()

Method Detail

_enterNestedEventLoopback to summary
protected abstract Object _enterNestedEventLoop()
_getKeyCodeForCharback to summary
protected abstract int _getKeyCodeForChar(char c, int hint)
_invokeAndWaitback to summary
protected abstract void _invokeAndWait(Runnable runnable)
_invokeLaterback to summary
protected abstract void _invokeLater(Runnable runnable)
_isKeyLockedback to summary
protected int _isKeyLocked(int keyCode)
_leaveNestedEventLoopback to summary
protected abstract void _leaveNestedEventLoop(Object retValue)
_overrideNativeWindowHandleback to summary
private static native void _overrideNativeWindowHandle(Class<T> lwFrameWrapperClass, Object frame, long handle, Runnable closeWindow)
_supportsInputMethodsback to summary
protected boolean _supportsInputMethods()
_supportsSystemMenuback to summary
protected boolean _supportsSystemMenu()
_supportsTransparentWindowsback to summary
protected abstract boolean _supportsTransparentWindows()
_supportsUnifiedWindowsback to summary
protected abstract boolean _supportsUnifiedWindows()
checkEventThreadback to summary
public static void checkEventThread()

Verifies that the current thread is the event thread, and throws an exception if this is not so. The check can be disabled by setting the "glass.disableThreadChecks" system property. It is preferred, however, to fix the application code instead.

Exceptions
IllegalStateException:
if the current thread is not the event thread
checkPlatformPreferencesSupportback to summary
public void checkPlatformPreferencesSupport()

Checks whether there are any problems with platform preferences detection, and if so, emits a warning.

createAccessibleback to summary
public Accessible createAccessible()
createCursorback to summary
public abstract Cursor createCursor(int type)
createCursorback to summary
public abstract Cursor createCursor(int x, int y, Pixels pixels)
createEventLoopback to summary
public final EventLoop createEventLoop()
createMenuback to summary
public final Menu createMenu(String title)
createMenuback to summary
public final Menu createMenu(String title, boolean enabled)
createMenuBarback to summary
public final MenuBar createMenuBar()
createMenuItemback to summary
public final MenuItem createMenuItem(String title)
createMenuItemback to summary
public final MenuItem createMenuItem(String title, MenuItem.Callback callback)
createMenuItemback to summary
public final MenuItem createMenuItem(String title, MenuItem.Callback callback, int shortcutKey, int shortcutModifiers)
createMenuItemback to summary
public final MenuItem createMenuItem(String title, MenuItem.Callback callback, int shortcutKey, int shortcutModifiers, Pixels pixels)
createPixelsback to summary
public abstract Pixels createPixels(int width, int height, ByteBuffer data)
createPixelsback to summary
public abstract Pixels createPixels(int width, int height, ByteBuffer data, float scalex, float scaley)
createPixelsback to summary
public abstract Pixels createPixels(int width, int height, IntBuffer data)
createPixelsback to summary
public abstract Pixels createPixels(int width, int height, IntBuffer data, float scalex, float scaley)
createPixelsback to summary
pack-priv static Pixels createPixels(int width, int height, int[] data, float scalex, float scaley)
createRobotback to summary
public abstract GlassRobot createRobot()
createTimerback to summary
public abstract Timer createTimer(Runnable runnable)
createViewback to summary
public abstract View createView()
createWindowback to summary
public abstract Window createWindow(Window owner, Screen screen, int styleMask)

Create a window. The styleMask argument is a bitmask of window styles as defined in the Window class. Note, however, that visual kinds (UNTITLED, TITLED, or TRANSPARENT) can't be combined together. Also, functional types (NORMAL, POPUP, or UTILITY) can't be combined together. A window is allowed to be of exactly one visual kind, and exactly one functional type.

createWindowback to summary
public final Window createWindow(Screen screen, int styleMask)

Create a window. The styleMask argument is a bitmask of window styles as defined in the Window class. Note, however, that visual kinds (UNTITLED, TITLED, or TRANSPARENT) can't be combined together. Also, functional types (NORMAL, POPUP, or UTILITY) can't be combined together. A window is allowed to be of exactly one visual kind, and exactly one functional type.

enterNestedEventLoopback to summary
pack-priv static Object enterNestedEventLoop()

Starts a nested event loop. Calling this method temporarily blocks processing of the current event, and starts a nested event loop to handle other native events. To proceed with the blocked execution path, the application should call the leaveNestedEventLoop(Object) method. Note that this method may only be invoked on the main (event handling) thread. An application may enter several nested loops recursively. There's no limit of recursion other than that imposed by the native stack size.

Returns:Object

an object passed to the leaveNestedEventLoop() method

Exceptions
RuntimeException:
if the current thread is not the main thread
finishTerminatingback to summary
protected void finishTerminating()
GetApplicationback to summary
public static Application GetApplication()
getDataDirectoryback to summary
public String getDataDirectory()

Gets a platform specific path that can be used to store application data. The application name typically appears as part of the path. On some platforms, the path may not yet exist and the caller will need to create it.

Returns:String

the platform specific path for the application data

getDeviceDetailsback to summary
public static Map<K, V> getDeviceDetails()
getEventHandlerback to summary
public Application.EventHandler getEventHandler()
getEventThreadback to summary
protected static Thread getEventThread()
getKeyCodeForCharback to summary
public static int getKeyCodeForChar(char c, int hint)

Returns a VK_ code of a key capable of producing the given unicode character with respect to the currently active keyboard layout or VK_UNDEFINED if the character isn't present in the current layout. The hint is the VK_ code of the key the system is attempting to match (which may be VK_UNDEFINED for a key on the main keyboard). It can be used to optimize the search or to distinguish between the main keyboard and the numeric keypad.

Parameters
c:char

the character

hint:int

the code of the key the system is attempting to match

Returns:int

integer code for the given char

getNameback to summary
public String getName()

Gets the name for the application. The application name may be used to identify the application in the user interface or as part of the platform specific path used to store application data. This is a hint and may not be used on some platforms.

Returns:String

the application name

getPlatformKeyMappingsback to summary
public Map<String, PreferenceMapping<?, ?>> getPlatformKeyMappings()

Returns a map of platform-specific keys to platform-independent keys defined by JavaFX, including a function that maps the platform-specific value to the platform-independent value.

For example, the platform-specific key "Windows.UIColor.Foreground" is mapped to the key "foregroundColor", which makes it easier to write shared code without depending on platform-specific details.

The following platform-independent keys are currently supported, which correspond to the names of properties on the com.sun.javafx.application.preferences.PreferenceProperties class:

  • foregroundColor
  • backgroundColor
  • accentColor
  • reducedMotion
  • reducedTransparency
  • persistentScrollBars
Returns:Map<String, PreferenceMapping<?, ?>>

a map of platform-specific keys to well-known keys

getPlatformKeysback to summary
public Map<String, Class<?>> getPlatformKeys()

Returns a mapping of platform-specific keys to the types of their values. Polymorphic types are supported by specifying the common base type; for example, a key can be mapped to Paint.class to support any type of paint.

Implementors must keep this map in sync with the mappings reported by the native Glass toolkit. If a native toolkit reports mappings for keys that are not contained in this map, the typed getters in javafx.application.Platform.Preferences might not throw IllegalArgumentException as specified.

Returns:Map<String, Class<?>>

a map of platform-specific keys to types

getPlatformPreferencesback to summary
public Map<String, Object> getPlatformPreferences()

Returns the current set of platform properties as a map of platform-specific keys to arbitrary values. This is a snapshot, and won't be updated. There are no guarantees on the implementation type, modifiability or serializability of the returned Map.

Returns:Map<String, Object>

the current set of platform preferences

getScaleFactorback to summary
pack-priv static float getScaleFactor(final int x, final int y, final int w, final int h)
hasMultiTouchback to summary
public boolean hasMultiTouch()
hasPointerback to summary
public boolean hasPointer()
hasTouchback to summary
public boolean hasTouch()
hasTwoLevelFocusback to summary
public boolean hasTwoLevelFocus()
hasVirtualKeyboardback to summary
public boolean hasVirtualKeyboard()
hasWindowManagerback to summary
public boolean hasWindowManager()
installDefaultMenusback to summary
public void installDefaultMenus(MenuBar menubar)

Install app's default native menus: on Mac OS X - Apple menu (showing the app name) with a single Quit menu item on Windows - NOP on Linux - NOP

invokeAndWaitback to summary
public static void invokeAndWait(Runnable runnable)

Block the current thread and wait until the given runnable finishes running on the native event loop thread.

invokeLaterback to summary
public static void invokeLater(Runnable runnable)

Schedule the given runnable to run on the native event loop thread some time in the future, and return immediately.

isEventThreadback to summary
public static boolean isEventThread()

Returns true if the current thread is the event thread.

isKeyLockedback to summary
public final Optional<Boolean> isKeyLocked(int keyCode)
isNestedLoopRunningback to summary
public static boolean isNestedLoopRunning()
leaveNestedEventLoopback to summary
pack-priv static void leaveNestedEventLoop(Object retValue)

Terminates the current nested event loop. After calling this method and returning from the current event handler, the execusion returns to the point where the enterNestedEventLoop was called previously. You may specify a return value for the enterNestedEventLoop() method by passing the argument retValue to the leaveNestedEventLoop(). Note that this method may only be invoked on the main (event handling) thread.

Exceptions
RuntimeException:
if the current thread is not the main thread
IllegalStateException:
if the application hasn't started a nested event loop
loadNativeLibraryback to summary
protected static synchronized void loadNativeLibrary(final String libname)
loadNativeLibraryback to summary
protected static synchronized void loadNativeLibrary()
notifyDidBecomeActiveback to summary
protected void notifyDidBecomeActive()
notifyDidFinishLaunchingback to summary
protected void notifyDidFinishLaunching()
notifyDidHideback to summary
protected void notifyDidHide()
notifyDidReceiveMemoryWarningback to summary
protected void notifyDidReceiveMemoryWarning()
notifyDidResignActiveback to summary
protected void notifyDidResignActive()
notifyDidUnhideback to summary
protected void notifyDidUnhide()
notifyOpenFilesback to summary
protected void notifyOpenFiles(String[] files)
notifyPreferencesChangedback to summary
protected void notifyPreferencesChanged(Map<String, Object> preferences)
notifyRenderingFinishedback to summary
public void notifyRenderingFinished()

Notifies the Application that rendering has completed for current pulse. This is called on the render thread.

notifyWillBecomeActiveback to summary
protected void notifyWillBecomeActive()
notifyWillFinishLaunchingback to summary
protected void notifyWillFinishLaunching()
notifyWillHideback to summary
protected void notifyWillHide()
notifyWillQuitback to summary
protected void notifyWillQuit()
notifyWillResignActiveback to summary
protected void notifyWillResignActive()
notifyWillUnhideback to summary
protected void notifyWillUnhide()
overrideNativeWindowHandleback to summary
public static void overrideNativeWindowHandle(Class<T> lwFrameWrapperClass, Object frame, long handle, Runnable closeWindow)
reportExceptionback to summary
public static void reportException(Throwable t)
runback to summary
public static void run(final Runnable launchable)
runLoopback to summary
protected abstract void runLoop(Runnable launchable)
setDeviceDetailsback to summary
public static void setDeviceDetails(Map<K, V> details)
setEventHandlerback to summary
public void setEventHandler(Application.EventHandler eventHandler)
setEventThreadback to summary
protected static void setEventThread(Thread thread)
setNameback to summary
public void setName(String name)

Sets the name for the application. The application name may be used to identify the application in the user interface or as part of the platform specific path used to store application data. The name could be set only once. All subsequent calls are ignored. This is a hint and may not be used on some platforms.

Parameters
name:String

the new application name

setTerminateWhenLastWindowClosedback to summary
public final void setTerminateWhenLastWindowClosed(boolean b)
shouldTerminateWhenLastWindowClosedback to summary
public final boolean shouldTerminateWhenLastWindowClosed()
shouldUpdateWindowback to summary
public boolean shouldUpdateWindow()
staticCommonDialogs_showFileChooserback to summary
protected abstract CommonDialogs.FileChooserResult staticCommonDialogs_showFileChooser(Window owner, String folder, String filename, String title, int type, boolean multipleMode, CommonDialogs.ExtensionFilter[] extensionFilters, int defaultFilterIndex)
staticCommonDialogs_showFolderChooserback to summary
protected abstract File staticCommonDialogs_showFolderChooser(Window owner, String folder, String title)
staticCursor_getBestSizeback to summary
protected abstract Size staticCursor_getBestSize(int width, int height)
staticCursor_setVisibleback to summary
protected abstract void staticCursor_setVisible(boolean visible)
staticPixels_getNativeFormatback to summary
protected abstract int staticPixels_getNativeFormat()
staticScreen_getScreensback to summary
protected abstract Screen[] staticScreen_getScreens()
staticScreen_getVideoRefreshPeriodback to summary
protected abstract double staticScreen_getVideoRefreshPeriod()
staticTimer_getMaxPeriodback to summary
protected abstract int staticTimer_getMaxPeriod()
staticTimer_getMinPeriodback to summary
protected abstract int staticTimer_getMinPeriod()
staticView_getMultiClickMaxXback to summary
protected abstract int staticView_getMultiClickMaxX()
staticView_getMultiClickMaxYback to summary
protected abstract int staticView_getMultiClickMaxY()
staticView_getMultiClickTimeback to summary
protected abstract long staticView_getMultiClickTime()
supportsInputMethodsback to summary
public final boolean supportsInputMethods()
supportsSystemMenuback to summary
public final boolean supportsSystemMenu()
supportsTransparentWindowsback to summary
public final boolean supportsTransparentWindows()
supportsUnifiedWindowsback to summary
public final boolean supportsUnifiedWindows()
terminateback to summary
public void terminate()
com.sun.glass.ui back to summary

public Class Application.EventHandler

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
public void
public void
public void
handleOpenFilesAction(Application app, long time, String[] files)

public void
public void
handleQuitAction(Application app, long time)

public void
public void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EventHandlerback to summary
public EventHandler()

Method Detail

handleDidBecomeActiveActionback to summary
public void handleDidBecomeActiveAction(Application app, long time)
handleDidFinishLaunchingActionback to summary
public void handleDidFinishLaunchingAction(Application app, long time)
handleDidHideActionback to summary
public void handleDidHideAction(Application app, long time)
handleDidReceiveMemoryWarningback to summary
public void handleDidReceiveMemoryWarning(Application app, long time)
handleDidResignActiveActionback to summary
public void handleDidResignActiveAction(Application app, long time)
handleDidUnhideActionback to summary
public void handleDidUnhideAction(Application app, long time)
handleOpenFilesActionback to summary
public void handleOpenFilesAction(Application app, long time, String[] files)
handlePreferencesChangedback to summary
public void handlePreferencesChanged(Map<String, Object> preferences)
handleQuitActionback to summary
public void handleQuitAction(Application app, long time)
handleWillBecomeActiveActionback to summary
public void handleWillBecomeActiveAction(Application app, long time)
handleWillFinishLaunchingActionback to summary
public void handleWillFinishLaunchingAction(Application app, long time)
handleWillHideActionback to summary
public void handleWillHideAction(Application app, long time)
handleWillResignActiveActionback to summary
public void handleWillResignActiveAction(Application app, long time)
handleWillUnhideActionback to summary
public void handleWillUnhideAction(Application app, long time)