1 /*
2 * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
79 * The default layout for a window is {@code BorderLayout}.
80 * <p>
81 * A window must have either a frame, dialog, or another window defined as its
82 * owner when it's constructed.
83 * <p>
84 * In a multi-screen environment, you can create a {@code Window}
85 * on a different screen device by constructing the {@code Window}
86 * with {@link #Window(Window, GraphicsConfiguration)}. The
87 * {@code GraphicsConfiguration} object is one of the
88 * {@code GraphicsConfiguration} objects of the target screen device.
89 * <p>
90 * In a virtual device multi-screen environment in which the desktop
91 * area could span multiple physical screen devices, the bounds of all
92 * configurations are relative to the virtual device coordinate system.
93 * The origin of the virtual-coordinate system is at the upper left-hand
94 * corner of the primary physical screen. Depending on the location of
95 * the primary screen in the virtual device, negative coordinates are
96 * possible, as shown in the following figure.
97 * <p>
98 * <img src="doc-files/MultiScreen.gif"
99 * alt="Diagram shows virtual device containing 4 physical screens. Primary physical screen shows coords (0,0), other screen shows (-80,-100)."
100 * style="float:center; margin: 7px 10px;">
101 * <p>
102 * In such an environment, when calling {@code setLocation},
103 * you must pass a virtual coordinate to this method. Similarly,
104 * calling {@code getLocationOnScreen} on a {@code Window} returns
105 * virtual device coordinates. Call the {@code getBounds} method
106 * of a {@code GraphicsConfiguration} to find its origin in the virtual
107 * coordinate system.
108 * <p>
109 * The following code sets the location of a {@code Window}
110 * at (10, 10) relative to the origin of the physical screen
111 * of the corresponding {@code GraphicsConfiguration}. If the
112 * bounds of the {@code GraphicsConfiguration} is not taken
113 * into account, the {@code Window} location would be set
114 * at (10, 10) relative to the virtual-coordinate system and would appear
115 * on the primary physical screen, which might be different from the
116 * physical screen of the specified {@code GraphicsConfiguration}.
117 *
118 * <pre>
119 * Window w = new Window(Window owner, GraphicsConfiguration gc);
120 * Rectangle bounds = gc.getBounds();
|
1 /*
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
79 * The default layout for a window is {@code BorderLayout}.
80 * <p>
81 * A window must have either a frame, dialog, or another window defined as its
82 * owner when it's constructed.
83 * <p>
84 * In a multi-screen environment, you can create a {@code Window}
85 * on a different screen device by constructing the {@code Window}
86 * with {@link #Window(Window, GraphicsConfiguration)}. The
87 * {@code GraphicsConfiguration} object is one of the
88 * {@code GraphicsConfiguration} objects of the target screen device.
89 * <p>
90 * In a virtual device multi-screen environment in which the desktop
91 * area could span multiple physical screen devices, the bounds of all
92 * configurations are relative to the virtual device coordinate system.
93 * The origin of the virtual-coordinate system is at the upper left-hand
94 * corner of the primary physical screen. Depending on the location of
95 * the primary screen in the virtual device, negative coordinates are
96 * possible, as shown in the following figure.
97 * <p>
98 * <img src="doc-files/MultiScreen.gif"
99 * alt="Diagram shows virtual device containing 4 physical screens. Primary
100 * physical screen shows coords (0,0), other screen shows (-80,-100)."
101 * style="margin: 7px 10px;">
102 * <p>
103 * In such an environment, when calling {@code setLocation},
104 * you must pass a virtual coordinate to this method. Similarly,
105 * calling {@code getLocationOnScreen} on a {@code Window} returns
106 * virtual device coordinates. Call the {@code getBounds} method
107 * of a {@code GraphicsConfiguration} to find its origin in the virtual
108 * coordinate system.
109 * <p>
110 * The following code sets the location of a {@code Window}
111 * at (10, 10) relative to the origin of the physical screen
112 * of the corresponding {@code GraphicsConfiguration}. If the
113 * bounds of the {@code GraphicsConfiguration} is not taken
114 * into account, the {@code Window} location would be set
115 * at (10, 10) relative to the virtual-coordinate system and would appear
116 * on the primary physical screen, which might be different from the
117 * physical screen of the specified {@code GraphicsConfiguration}.
118 *
119 * <pre>
120 * Window w = new Window(Window owner, GraphicsConfiguration gc);
121 * Rectangle bounds = gc.getBounds();
|