1 /*
2 test
3 @bug 6272324
4 @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
5 @author anton.tarasov@sun.com: area=awt.focus
6 @run applet NonFocusableBlockedOwnerTest.html
7 */
8
9 import java.applet.Applet;
10 import java.awt.*;
11 import java.awt.event.*;
12 import java.lang.reflect.*;
13
14 public class NonFocusableBlockedOwnerTest extends Applet {
15 Robot robot;
16 Frame frame = new Frame("Modal Blocked Frame");
17 Dialog dialog = new Dialog(frame, "Modal Dialog", true);
18 Window excluded = new Window(frame);
19 Button button = new Button("button");
20
21 public static void main(String[] args) {
93 robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
94 }
95 robot.mousePress(InputEvent.BUTTON1_MASK);
96 robot.mouseRelease(InputEvent.BUTTON1_MASK);
97 waitForIdle();
98 }
99
100 void waitTillShown(Component c) {
101 while (true) {
102 try {
103 Thread.sleep(100);
104 c.getLocationOnScreen();
105 break;
106 } catch (InterruptedException e) {
107 throw new RuntimeException(e);
108 } catch (IllegalComponentStateException e) {}
109 }
110 }
111 void waitForIdle() {
112 try {
113 Toolkit.getDefaultToolkit().sync();
114 sun.awt.SunToolkit.flushPendingEvents();
115 EventQueue.invokeAndWait( new Runnable() {
116 public void run() {} // Dummy implementation
117 });
118 } catch(InterruptedException ie) {
119 Sysout.println("waitForIdle, non-fatal exception caught:");
120 ie.printStackTrace();
121 } catch(InvocationTargetException ite) {
122 Sysout.println("waitForIdle, non-fatal exception caught:");
123 ite.printStackTrace();
124 }
125
126 // wait longer...
127 robot.delay(200);
128 }
129 }
130
131 /****************************************************
132 Standard Test Machinery
133 DO NOT modify anything below -- it's a standard
134 chunk of code whose purpose is to make user
|
1 /*
2 * Copyright (c) 2005, 2015, 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.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 test
26 @bug 6272324
27 @summary Modal excluded Window which decorated parent is blocked should be non-focusable.
28 @author anton.tarasov@sun.com: area=awt.focus
29 @run applet NonFocusableBlockedOwnerTest.html
30 */
31
32 import java.applet.Applet;
33 import java.awt.*;
34 import java.awt.event.*;
35 import java.lang.reflect.*;
36
37 public class NonFocusableBlockedOwnerTest extends Applet {
38 Robot robot;
39 Frame frame = new Frame("Modal Blocked Frame");
40 Dialog dialog = new Dialog(frame, "Modal Dialog", true);
41 Window excluded = new Window(frame);
42 Button button = new Button("button");
43
44 public static void main(String[] args) {
116 robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
117 }
118 robot.mousePress(InputEvent.BUTTON1_MASK);
119 robot.mouseRelease(InputEvent.BUTTON1_MASK);
120 waitForIdle();
121 }
122
123 void waitTillShown(Component c) {
124 while (true) {
125 try {
126 Thread.sleep(100);
127 c.getLocationOnScreen();
128 break;
129 } catch (InterruptedException e) {
130 throw new RuntimeException(e);
131 } catch (IllegalComponentStateException e) {}
132 }
133 }
134 void waitForIdle() {
135 try {
136 robot.waitForIdle();
137 EventQueue.invokeAndWait( new Runnable() {
138 public void run() {} // Dummy implementation
139 });
140 } catch(InterruptedException ie) {
141 Sysout.println("waitForIdle, non-fatal exception caught:");
142 ie.printStackTrace();
143 } catch(InvocationTargetException ite) {
144 Sysout.println("waitForIdle, non-fatal exception caught:");
145 ite.printStackTrace();
146 }
147
148 // wait longer...
149 robot.delay(200);
150 }
151 }
152
153 /****************************************************
154 Standard Test Machinery
155 DO NOT modify anything below -- it's a standard
156 chunk of code whose purpose is to make user
|