19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 |
|
25 /* |
24 /* |
26 test |
25 @test |
|
26 @key headful |
27 @bug 4828019 |
27 @bug 4828019 |
28 @summary Frame/Window deadlock |
28 @summary Frame/Window deadlock |
29 @author yan@sparc.spb.su: area= |
29 @run main/timeout=9999 NonEDT_GUI_Deadlock |
30 @run applet NonEDT_GUI_Deadlock.html |
|
31 */ |
30 */ |
32 |
31 |
33 // Note there is no @ in front of test above. This is so that the |
32 import java.awt.*; |
34 // harness will not mistake this file as a test file. It should |
|
35 // only see the html file as a test file. (the harness runs all |
|
36 // valid test files, so it would run this test twice if this file |
|
37 // were valid as well as the html file.) |
|
38 // Also, note the area= after Your Name in the author tag. Here, you |
|
39 // should put which functional area the test falls in. See the |
|
40 // AWT-core home page -> test areas and/or -> AWT team for a list of |
|
41 // areas. |
|
42 // Note also the 'AutomaticAppletTest.html' in the run tag. This should |
|
43 // be changed to the name of the test. |
|
44 |
33 |
45 |
34 public class NonEDT_GUI_Deadlock { |
46 /** |
|
47 * NonEDT_GUI_Deadlock.java |
|
48 * |
|
49 * summary: |
|
50 */ |
|
51 |
|
52 import java.applet.Applet; |
|
53 import java.awt.*; |
|
54 import java.awt.event.*; |
|
55 import java.net.*; |
|
56 import java.io.*; |
|
57 |
|
58 |
|
59 //Automated tests should run as applet tests if possible because they |
|
60 // get their environments cleaned up, including AWT threads, any |
|
61 // test created threads, and any system resources used by the test |
|
62 // such as file descriptors. (This is normally not a problem as |
|
63 // main tests usually run in a separate VM, however on some platforms |
|
64 // such as the Mac, separate VMs are not possible and non-applet |
|
65 // tests will cause problems). Also, you don't have to worry about |
|
66 // synchronisation stuff in Applet tests they way you do in main |
|
67 // tests... |
|
68 |
|
69 |
|
70 public class NonEDT_GUI_Deadlock extends Applet |
|
71 { |
|
72 //Declare things used in the test, like buttons and labels here |
|
73 boolean bOK = false; |
35 boolean bOK = false; |
74 Thread badThread = null; |
36 Thread badThread = null; |
75 |
37 |
76 public void init() |
|
77 { |
|
78 }//End init() |
|
79 |
|
80 public void start () |
38 public void start () |
81 { |
39 { |
82 //Get things going. Request focus, set size, et cetera |
|
83 |
|
84 setSize (200,300); |
|
85 setVisible(true); |
|
86 validate(); |
|
87 |
|
88 final Frame theFrame = new Frame("Window test"); |
40 final Frame theFrame = new Frame("Window test"); |
89 theFrame.setSize(240, 200); |
41 theFrame.setSize(240, 200); |
90 |
42 |
91 Thread thKiller = new Thread() { |
43 Thread thKiller = new Thread() { |
92 public void run() { |
44 public void run() { |