test/jdk/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java
changeset 54231 e4813eded7cb
parent 47216 71c04702a3d5
equal deleted inserted replaced
54230:d9d9655bb077 54231:e4813eded7cb
    24 /*
    24 /*
    25   @test
    25   @test
    26   @key headful
    26   @key headful
    27   @bug      4823903
    27   @bug      4823903
    28   @summary  Tests actual focused window retaining.
    28   @summary  Tests actual focused window retaining.
    29   @author   Anton.Tarasov: area=awt.focus
       
    30   @library  ../../regtesthelpers
    29   @library  ../../regtesthelpers
    31   @build    Util
    30   @build    Util
    32   @run      main ActualFocusedWindowRetaining
    31   @run      main ActualFocusedWindowRetaining
    33 */
    32 */
    34 
    33 
    35 import java.awt.*;
    34 import java.awt.*;
    36 import java.awt.event.*;
    35 import java.awt.event.*;
    37 import java.lang.reflect.*;
       
    38 import java.applet.*;
       
    39 import test.java.awt.regtesthelpers.Util;
    36 import test.java.awt.regtesthelpers.Util;
    40 
    37 
    41 public class ActualFocusedWindowRetaining extends Applet {
    38 public class ActualFocusedWindowRetaining {
    42     public static Frame frame = new Frame("Other Frame");
    39     public static Frame frame = new Frame("Other Frame");
    43     public static Frame owner = new Frame("Test Frame");
    40     public static Frame owner = new Frame("Test Frame");
    44     public static Button otherButton1 = new Button("Other Button 1");
    41     public static Button otherButton1 = new Button("Other Button 1");
    45     public static Button otherButton2 = new Button("Other Button 2");
    42     public static Button otherButton2 = new Button("Other Button 2");
    46     public static Button otherButton3 = new Button("Other Button 3");
    43     public static Button otherButton3 = new Button("Other Button 3");
    52     public static int step;
    49     public static int step;
    53     public static Robot robot = Util.createRobot();
    50     public static Robot robot = Util.createRobot();
    54 
    51 
    55     public static void main(String[] args) {
    52     public static void main(String[] args) {
    56         ActualFocusedWindowRetaining a = new ActualFocusedWindowRetaining();
    53         ActualFocusedWindowRetaining a = new ActualFocusedWindowRetaining();
    57         a.init();
       
    58         a.start();
    54         a.start();
    59     }
    55     }
    60 
    56 
    61     public void start () {
    57     public void start () {
    62         Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
    58         Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
    74                         System.out.println(e.paramString() + " on <Non-testing component>");
    70                         System.out.println(e.paramString() + " on <Non-testing component>");
    75                     }
    71                     }
    76                 }
    72                 }
    77             }, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
    73             }, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
    78 
    74 
    79         setSize (500, 200);
       
    80         setVisible(true);
       
    81         validate();
       
    82 
       
    83         frame.setSize(new Dimension(400, 100));
    75         frame.setSize(new Dimension(400, 100));
    84         frame.setLocation(800, 400);
    76         frame.setLocation(800, 400);
    85         frame.setVisible(true);
    77         frame.setVisible(true);
    86         frame.toFront();
    78         frame.toFront();
    87 
    79