List of all members.
Windowobject is a top-level window with no borders and no menubar.
The default layout for a window is
A window must have either a frame, dialog, or another window defined as its owner when it's constructed.
In a multi-screen environment, you can create a
Window on a different screen device by constructing the
Window with Window(Window, GraphicsConfiguration). The
GraphicsConfiguration object is one of the
GraphicsConfiguration objects of the target screen device.
In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices, the bounds of all configurations are relative to the virtual device coordinate system. The origin of the virtual-coordinate system is at the upper left-hand corner of the primary physical screen. Depending on the location of the primary screen in the virtual device, negative coordinates are possible, as shown in the following figure.
In such an environment, when calling
setLocation, you must pass a virtual coordinate to this method. Similarly, calling
getLocationOnScreen on a
Window returns virtual device coordinates. Call the
getBounds method of a
GraphicsConfiguration to find its origin in the virtual coordinate system.
The following code sets the location of a
Window at (10, 10) relative to the origin of the physical screen of the corresponding
GraphicsConfiguration. If the bounds of the
GraphicsConfiguration is not taken into account, the
Window location would be set at (10, 10) relative to the virtual-coordinate system and would appear on the primary physical screen, which might be different from the physical screen of the specified
Window w = new Window(Window owner, GraphicsConfiguration gc); Rectangle bounds = gc.getBounds(); w.setLocation(10 + bounds.x, 10 + bounds.y);
Windows are capable of generating the following WindowEvents: WindowOpened, WindowClosed, WindowGainedFocus, WindowLostFocus.
Public Member Functions
|Window (const Ref< Window > &owner)|
|Constructs a new invisible window with the specified |
|virtual void||dispose ()|
|Releases all of the native screen resources used by this |
|virtual void||pack ()|
|Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. |
|virtual void||toFront ()|
|If this Window is visible, brings this Window to the front and may make it the focused Window. |
|virtual void||toBack ()|
|If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window. |
|virtual void||setVisible (jboolean b)|
|Shows or hides this component depending on the value of parameter |
|virtual Ref< Window >||getOwner () const|
|Returns the owner of this window. |
|virtual Ref< List >||getOwnedWindows () const|
|Return an array containing all the windows this window currently owns. |
|virtual Ref< List >||getListeners (const Class &type) const|
|Returns an array of all the objects currently registered as |
|virtual jboolean||eventEnabled (const AWTEvent &e) const|
|virtual void||processEvent (const AWTEvent &e)|
|Processes events on this window. |
|virtual void||dispatchEvent (AWTEvent &e)|
|Dispatches an event to this component or one of its sub components. |
|virtual String||toString () const|
|Returns a string representation of this component and its values. |
Constructs a new invisible window with the specified
Window as its owner.
If there is a security manager, this method first calls the security manager's
checkTopLevelWindow method with
this as its argument to determine whether or not the window must be displayed with a warning banner.
|IllegalArgumentException||if the |
|virtual void java::awt::Window::dispose||(||)||
Releases all of the native screen resources used by this
Window, its subcomponents, and all of its owned children.
That is, the resources for these
Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.
Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to
show. The states of the recreated
Window and its subcomponents will be identical to the states of these objects at the point where the
Window was disposed (not accounting for additional modifications between those actions).
Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.
|virtual void java::awt::Window::pack||(||)||
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.
If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.
|virtual void java::awt::Window::toFront||(||)||
Places this Window at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place if this Window is not visible. Some platforms do not allow Windows which own other Windows to appear on top of those owned Windows. Some platforms may not permit this VM to place its Windows above windows of native applications, or Windows of other VMs. This permission may depend on whether a Window in this VM is already focused. Every attempt will be made to move this Window as high as possible in the stacking order; however, developers should not assume that this method will move this Window above all other windows in every situation.
Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is the focused or active Window until this Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. On platforms where the top-most window is the focused window, this method will probably focus this Window, if it is not already focused. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.
If this method causes this Window to be focused, and this Window is a Frame or a Dialog, it will also become activated. If this Window is focused, but it is not a Frame or a Dialog, then the first Frame or Dialog that is an owner of this Window will be activated.
|virtual void java::awt::Window::toBack||(||)||
Places this Window at the bottom of the stacking order and shows it behind any other Windows in this VM. No action will take place is this Window is not visible. Some platforms do not allow Windows which are owned by other Windows to appear below their owners. Every attempt will be made to move this Window as low as possible in the stacking order; however, developers should not assume that this method will move this Window below all other windows in every situation.
Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is no longer the focused or active Window until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED event. On platforms where the top-most window is the focused window, this method will probably cause this Window to lose focus. In that case, the next highest, focusable Window in this VM will receive focus. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.
|virtual void java::awt::Window::setVisible||(||jboolean||b||)||
Returns the owner of this window.
Return an array containing all the windows this window currently owns.
Returns an array of all the objects currently registered as
FooListeners upon this
FooListeners are registered using the
You can specify the
listenerType argument with a class literal, such as
FooListener.class. For example, you can query a
w for its window listeners with the following code:
WindowListener wls = (WindowListener)(w.getListeners(WindowListener.class));
If no such listeners exist, this method returns an empty array.
|listenerType||the type of listeners requested; this parameter should specify an interface that descends from |
FooListeners on this window, or an empty array if no such listeners have been added
Reimplemented from java::awt::Container.
Reimplemented from java::awt::Container.
|virtual void java::awt::Window::processEvent||(||const AWTEvent &||e||)||
Processes events on this window.
If the event is an
WindowEvent, it invokes the
processWindowEvent method, else it invokes its superclass's
Note that if the event parameter is
null the behavior is unspecified and may result in an exception.
Reimplemented from java::awt::Container.
|virtual void java::awt::Window::dispatchEvent||(||AWTEvent &||e||)||
|virtual String java::awt::Window::toString||(||)|| const