public final class WindowUtils extends Object
A static utility class providing useful functionality for dealing with
Window objects.
The methods defined in this utility class can be used to obtain information
about window objects. They support casts to the Window
interface and allow for accessing the underlying GUI library specific window
implementation.
| Modifier and Type | Method and Description |
|---|---|
static Object |
getPlatformWindow(Window window)
Returns the platform (or GUI library) specific window that is represented
by the passed in
Window object. |
static Window |
toWindow(Object wnd)
Tries to cast the specified object into a
Window. |
static Window |
toWindowEx(Object wnd)
Tries to cast the specified object into a
Window. |
static Window |
windowFromEvent(WindowEvent event)
Tries to cast the source window from the specified event object into a
Window object. |
static Window |
windowFromEventEx(WindowEvent event)
Tries to cast the source window from the specified event object into a
Window object. |
public static Window toWindow(Object wnd)
Window. If this is
possible, the resulting Window is returned. Otherwise the return
value is null.wnd - the object to cast to a WindowWindow object or nullpublic static Window toWindowEx(Object wnd) throws IllegalArgumentException
Window.
Different to toWindow(), this method will never return
null. Instead, if the passed in object cannot be cast to a
Window, an IllegalArgumentException
exception will be thrown.wnd - the object to cast to a WindowIllegalArgumentException - if casting failspublic static Window windowFromEvent(WindowEvent event)
Window object. If this is possible, the Window object is
returned. Otherwise the return value is null. This method is
useful when dealing with
WindowEvent objects because it handles null input
gracefully.event - the event object; if null, the return value will be
null, tooWindow or nullpublic static Window windowFromEventEx(WindowEvent event) throws IllegalArgumentException
Window object. Works like windowFromEvent(),
but throws an IllegalArgumentException exception if the
source window cannot be determined.event - the event objectIllegalArgumentException - if the source window cannot be obtainedpublic static Object getPlatformWindow(Window window) throws IllegalArgumentException
Window object. This method checks if the
passed in object implements the WindowWrapper interface.
If this is the case, the wrapped window will be fetched and checked
again. Otherwise the window itself will be returned.window - the window (must not be null)IllegalArgumentException - if the parameter is nullCopyright © 2016 The JGUIraffe Team. All rights reserved.