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 /* |
24 /* |
25 test |
25 @test |
|
26 @key headful |
26 @bug 4092033 4529626 |
27 @bug 4092033 4529626 |
27 @summary Tests that toFront makes window focused unless it is non-focusable |
28 @summary Tests that toFront makes window focused unless it is non-focusable |
28 @author area=awt.focus |
29 @library ../../regtesthelpers |
29 @run applet ToFrontFocus.html |
30 @build Util |
|
31 @run main ToFrontFocus |
30 */ |
32 */ |
31 |
33 |
32 /** |
|
33 * ToFrontFocus.java |
|
34 * |
|
35 * summary: |
|
36 */ |
|
37 |
|
38 import java.applet.Applet; |
|
39 import java.awt.*; |
34 import java.awt.*; |
40 import java.awt.event.*; |
35 import java.awt.event.*; |
41 import test.java.awt.regtesthelpers.Util; |
36 import test.java.awt.regtesthelpers.Util; |
42 |
37 |
43 public class ToFrontFocus extends Applet |
38 public class ToFrontFocus { |
44 { |
|
45 //Declare things used in the test, like buttons and labels here |
|
46 |
|
47 Frame cover, focus_frame, nonfocus_frame; |
39 Frame cover, focus_frame, nonfocus_frame; |
48 Button focus_button, nonfocus_button; |
40 Button focus_button, nonfocus_button; |
49 volatile boolean focus_gained = false, nonfocus_gained = false; |
41 volatile boolean focus_gained = false, nonfocus_gained = false; |
50 public void init() |
42 |
|
43 public static void main(final String[] args) { |
|
44 ToFrontFocus app = new ToFrontFocus(); |
|
45 app.init(); |
|
46 app.start(); |
|
47 } |
|
48 |
|
49 public void init() |
51 { |
50 { |
52 //Create instructions for the user here, as well as set up |
|
53 // the environment -- set the layout manager, add buttons, |
|
54 // etc. |
|
55 |
|
56 this.setLayout (new BorderLayout ()); |
|
57 |
|
58 cover = new Frame("Cover frame"); |
51 cover = new Frame("Cover frame"); |
59 cover.setBounds(100, 100, 200, 200); |
52 cover.setBounds(100, 100, 200, 200); |
60 focus_frame = new Frame("Focusable frame"); |
53 focus_frame = new Frame("Focusable frame"); |
61 focus_frame.setBounds(150, 100, 250, 150); |
54 focus_frame.setBounds(150, 100, 250, 150); |
62 nonfocus_frame = new Frame("Non-focusable frame"); |
55 nonfocus_frame = new Frame("Non-focusable frame"); |