java.awt
Class Window
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
This class represents a top-level window with no decorations.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Warren Levy <warrenl@cygnus.com>
Window
public Window(java.awt.Frame owner)
Initializes a new instance of Window
with the specified
parent. The window will initially be invisible.
Parameters:
Throws:
IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null; this exception is always
thrown when GraphicsEnvironment.isHeadless returns true.
Window
public Window(java.awt.Window owner)
Initializes a new instance of Window
with the specified
parent. The window will initially be invisible.
Since:Parameters:
Throws:
IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null; this exception is always
thrown when GraphicsEnvironment.isHeadless returns true.
Window
public Window(java.awt.Window owner, java.awt.GraphicsConfiguration gc)
Initializes a new instance of Window
with the specified
parent. The window will initially be invisible.
Since:Parameters:
Throws:
IllegalArgumentException
- If owner is null or if gc is not from a
screen device; this exception is always thrown when
GraphicsEnvironment.isHeadless returns true.
addNotify
public void addNotify()
Creates the native peer for this window.
addWindowFocusListener
public void addWindowFocusListener(java.awt.event.WindowFocusListener wfl)
Adds the specified listener to this window.
Parameters:
addWindowListener
public synchronized void addWindowListener(java.awt.event.WindowListener listener)
Adds the specified listener to the list of WindowListeners
that will receive events for this window.
Parameters:
addWindowStateListener
public void addWindowStateListener(java.awt.event.WindowStateListener wsl)
Adds the specified listener to this window.
Since:Parameters:
applyResourceBundle
public void applyResourceBundle(java.lang.String rbName)
Since:Parameters:
applyResourceBundle
public void applyResourceBundle(java.util.ResourceBundle rb)
Since:Parameters:
dispose
public void dispose()
Called to free any resource associated with this window.
finalize
protected void finalize()
Disposes of the input methods and context, and removes the WeakReference
which formerly pointed to this Window from the parent's owned Window list.
Throws:
Throwable
- The Exception raised by this method.
getFocusOwner
public Component getFocusOwner()
Returns the child window that has focus if this window is active.
This method returns null
if this window is not active
or no children have focus.
Returns:
- The component that has focus, or
null
if no
component has focus.
getGraphicsConfiguration
public GraphicsConfiguration getGraphicsConfiguration()
Get graphics configuration. The implementation for Window will
not ask any parent containers, since Window is a toplevel
window and not actually embedded in the parent component.
getListeners
public EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this Window. FooListeners are registered using the addFooListener
method.
Since:Parameters:
Throws:
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
getLocale
public Locale getLocale()
Returns the locale that this window is configured for.
Returns:
- The locale this window is configured for.
getOwnedWindows
public Window[] getOwnedWindows()
Since:
getOwner
public Window getOwner()
getToolkit
public Toolkit getToolkit()
Returns the toolkit used to create this window.
Returns:
- The toolkit used to create this window.
getWarningString
public final String getWarningString()
Returns the warning string that will be displayed if this window is
popped up by an unsecure applet or application.
Returns:
- The unsecure window warning message.
getWindowFocusListeners
public synchronized WindowFocusListener[] getWindowFocusListeners()
Returns an array of all the window focus listeners registered on this
window.
Since:
getWindowListeners
public synchronized WindowListener[] getWindowListeners()
Returns an array of all the window listeners registered on this window.
Since:
getWindowStateListeners
public synchronized WindowStateListener[] getWindowStateListeners()
Returns an array of all the window state listeners registered on this
window.
Since:
hide
public void hide()
isDisplayable
public boolean isDisplayable()
isShowing
public boolean isShowing()
Tests whether or not this window is visible on the screen.
Returns:
true
if this window is visible, false
otherwise.
pack
public void pack()
Relays out this window's child components at their preferred size.
postEvent
public boolean postEvent(java.awt.Event e)
Post a Java 1.0 event to the event queue.
Parameters:
processEvent
protected void processEvent(java.awt.AWTEvent evt)
Processes the specified event for this window. If the event is an
instance of WindowEvent
, then
processWindowEvent()
is called to process the event,
otherwise the superclass version of this method is invoked.
Parameters:
processWindowEvent
protected void processWindowEvent(java.awt.event.WindowEvent evt)
Dispatches this event to any listeners that are listening for
WindowEvents
on this window. This method only gets
invoked if it is enabled via enableEvents()
or if
a listener has been added.
Parameters:
removeWindowFocusListener
public void removeWindowFocusListener(java.awt.event.WindowFocusListener wfl)
Removes the specified listener from this window.
Parameters:
removeWindowListener
public synchronized void removeWindowListener(java.awt.event.WindowListener listener)
Removes the specified listener from the list of
WindowListeners
that will receive events for this window.
Parameters:
removeWindowStateListener
public void removeWindowStateListener(java.awt.event.WindowStateListener wsl)
Removes the specified listener from this window.
Since:Parameters:
setCursor
public void setCursor(java.awt.Cursor cursor)
Sets the cursor for this window to the specifiec cursor.
Parameters:
show
public void show()
Makes this window visible and brings it to the front.
toBack
public void toBack()
Sends this window to the back so that all other windows display in
front of it.
toFront
public void toFront()
Brings this window to the front so that it displays in front of
any other windows.