test/jdk/java/awt/Focus/ChildWindowFocusTest/ChildWindowFocusTest.java
changeset 54231 e4813eded7cb
parent 50834 9cf279436b9d
equal deleted inserted replaced
54230:d9d9655bb077 54231:e4813eded7cb
    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        5090325
    27   @bug        5090325
    27   @summary    Tests that Window's child can be focused on XAWT.
    28   @summary    Tests that Window's child can be focused on XAWT.
    28   @author     anton.tarasov@sun.com: area=awt.focus
    29   @run        main ChildWindowFocusTest
    29   @run        applet ChildWindowFocusTest.html
       
    30 */
    30 */
    31 
    31 
    32 import java.awt.*;
    32 import java.awt.*;
    33 import java.awt.event.*;
    33 import java.awt.event.*;
    34 import java.applet.Applet;
       
    35 import java.lang.reflect.*;
       
    36 
    34 
    37 public class ChildWindowFocusTest extends Applet {
    35 public class ChildWindowFocusTest {
    38     Robot robot;
    36     Robot robot;
    39     Frame frame = new Frame("Owner");
    37     Frame frame = new Frame("Owner");
    40     Button button0 = new Button("button-0");
    38     Button button0 = new Button("button-0");
    41     TextField text0 = new TextField("text-0");
    39     TextField text0 = new TextField("text-0");
    42     TextField text1 = new TextField("text-1");
    40     TextField text1 = new TextField("text-1");
    44     Window win2 = new TestWindow(win1, text1, 220);
    42     Window win2 = new TestWindow(win1, text1, 220);
    45     Frame outerFrame = new Frame("Outer");
    43     Frame outerFrame = new Frame("Outer");
    46     Button button1 = new Button("button-1");
    44     Button button1 = new Button("button-1");
    47     int shift;
    45     int shift;
    48 
    46 
       
    47     public static void main(final String[] args) {
       
    48         ChildWindowFocusTest app = new ChildWindowFocusTest();
       
    49         app.init();
       
    50         app.start();
       
    51     }
       
    52 
    49     public void init() {
    53     public void init() {
    50         try {
    54         try {
    51             robot = new Robot();
    55             robot = new Robot();
    52         } catch (AWTException e) {
    56         } catch (AWTException e) {
    53             throw new RuntimeException("Error: unable to create robot", e);
    57             throw new RuntimeException("Error: unable to create robot", e);
    54         }
    58         }
    55         // Create instructions for the user here, as well as set up
       
    56         // the environment -- set the layout manager, add buttons,
       
    57         // etc.
       
    58         this.setLayout (new BorderLayout ());
       
    59         shift = 100;
    59         shift = 100;
    60     }
    60     }
    61 
    61 
    62     public void start() {
    62     public void start() {
    63 
    63