Window class methods in java

Class Window

A Window object is a top-level window with no borders and no menubar. The default layout for a window is BorderLayout .

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 GraphicsConfiguration .

Window w = new Window(Window owner, GraphicsConfiguration gc); Rectangle bounds = gc.getBounds(); w.setLocation(10 + bounds.x, 10 + bounds.y);

Note: the location and size of top-level windows (including Window s, Frame s, and Dialog s) are under the control of the desktop’s window management system. Calls to setLocation , setSize , and setBounds are requests (not directives) which are forwarded to the window management system. Every effort will be made to honor such requests. However, in some cases the window management system may ignore such requests, or modify the requested geometry in order to place and size the Window in a way that more closely matches the desktop settings.

Visual effects such as halos, shadows, motion effects and animations may be applied to the window by the desktop window management system. These are outside the knowledge and control of the AWT and so for the purposes of this specification are not considered part of the top-level window.

Читайте также:  Css где хранятся спреи

Due to the asynchronous nature of native event handling, the results returned by getBounds , getLocation , getLocationOnScreen , and getSize might not reflect the actual geometry of the Window on screen until the last request has been processed. During the processing of subsequent requests these values might change accordingly while the window management system fulfills the requests.

An application may set the size and location of an invisible Window arbitrarily, but the window management system may subsequently change its size and/or location when the Window is made visible. One or more ComponentEvent s will be generated to indicate the new geometry.

Windows are capable of generating the following WindowEvents: WindowOpened, WindowClosed, WindowGainedFocus, WindowLostFocus.

Источник

Uses of Class
java.awt.Window

Provides interfaces that enable the development of input methods that can be used with any Java runtime environment.

Provides a set of «lightweight» (all-Java language) components that, to the maximum degree possible, work the same on all platforms.

Uses of Window in com.sun.java.accessibility.util

Uses of Window in java.awt

A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.

Returns the active Window, even if the calling thread is in a different context than the active Window.

Returns the focused Window, even if the calling thread is in a different context than the focused Window.

Returns the Component that should receive the focus when a Window is made visible for the first time.

Constructs an initially invisible, modeless Dialog with the specified owner Window and an empty title.

Constructs an initially invisible Dialog with the specified owner Window and modality and an empty title.

Constructs an initially invisible Dialog with the specified owner Window , title, modality and GraphicsConfiguration .

Constructs a new, initially invisible window with the specified owner Window and a GraphicsConfiguration of a screen device.

Uses of Window in java.awt.event

Uses of Window in java.awt.im.spi

Uses of Window in javax.print.attribute.standard

Constructs an instance which can be used to request that the specified Window be the owner of the dialog.

Uses of Window in javax.swing

Uses of Window in javax.swing.plaf.basic

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Читайте также:  Bootstrap btn success css

Источник

Uses of Class
java.awt.Window

Provides interfaces that enable the development of input methods that can be used with any Java runtime environment.

Provides a set of «lightweight» (all-Java language) components that, to the maximum degree possible, work the same on all platforms.

Uses of Window in com.sun.java.accessibility.util

Uses of Window in java.awt

A Dialog is a top-level window with a title and a border that is typically used to take some form of input from the user.

Returns the active Window, even if the calling thread is in a different context than the active Window.

Returns the focused Window, even if the calling thread is in a different context than the focused Window.

Returns the Component that should receive the focus when a Window is made visible for the first time.

Constructs an initially invisible, modeless Dialog with the specified owner Window and an empty title.

Constructs an initially invisible Dialog with the specified owner Window and modality and an empty title.

Constructs an initially invisible Dialog with the specified owner Window , title, modality and GraphicsConfiguration .

Constructs a new, initially invisible window with the specified owner Window and a GraphicsConfiguration of a screen device.

Uses of Window in java.awt.event

Uses of Window in java.awt.im.spi

Uses of Window in javax.print.attribute.standard

Constructs an instance which can be used to request that the specified Window be the owner of the dialog.

Uses of Window in javax.swing

Uses of Window in javax.swing.plaf.basic

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Class Window

A Window object is a top-level window with no borders and no menubar. The default layout for a window is BorderLayout .

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.

Читайте также:  Accessing database with python

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 GraphicsConfiguration .

Window w = new Window(Window owner, GraphicsConfiguration gc); Rectangle bounds = gc.getBounds(); w.setLocation(10 + bounds.x, 10 + bounds.y);

Note: the location and size of top-level windows (including Window s, Frame s, and Dialog s) are under the control of the desktop’s window management system. Calls to setLocation , setSize , and setBounds are requests (not directives) which are forwarded to the window management system. Every effort will be made to honor such requests. However, in some cases the window management system may ignore such requests, or modify the requested geometry in order to place and size the Window in a way that more closely matches the desktop settings.

Visual effects such as halos, shadows, motion effects and animations may be applied to the window by the desktop window management system. These are outside the knowledge and control of the AWT and so for the purposes of this specification are not considered part of the top-level window.

Due to the asynchronous nature of native event handling, the results returned by getBounds , getLocation , getLocationOnScreen , and getSize might not reflect the actual geometry of the Window on screen until the last request has been processed. During the processing of subsequent requests these values might change accordingly while the window management system fulfills the requests.

An application may set the size and location of an invisible Window arbitrarily, but the window management system may subsequently change its size and/or location when the Window is made visible. One or more ComponentEvent s will be generated to indicate the new geometry.

Windows are capable of generating the following WindowEvents: WindowOpened, WindowClosed, WindowGainedFocus, WindowLostFocus.

Источник

Оцените статью