test/jdk/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.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   @bug       6426132
    26   @key headful
    27   @summary   A Window should be initially focused on its showing (XAWT bug).
    27   @bug        6426132
    28   @author    anton.tarasov@...: area=awt.focus
    28   @summary    A Window should be focused upon start (XAWT bug).
    29   @run       applet WindowInitialFocusTest.html
    29   @library    ../../regtesthelpers
       
    30   @build      Util
       
    31   @run        main WindowInitialFocusTest
    30 */
    32 */
    31 
    33 
    32 import java.awt.*;
    34 import java.awt.*;
    33 import java.awt.event.*;
    35 import java.awt.event.*;
    34 import java.applet.Applet;
       
    35 import java.util.concurrent.atomic.AtomicBoolean;
    36 import java.util.concurrent.atomic.AtomicBoolean;
    36 import test.java.awt.regtesthelpers.Util;
    37 import test.java.awt.regtesthelpers.Util;
    37 
    38 
    38 public class WindowInitialFocusTest extends Applet {
    39 public class WindowInitialFocusTest {
    39     Frame frame = new Frame("Test Frame");
    40     Frame frame = new Frame("Test Frame");
    40     Window window = new Window(frame);
    41     Window window = new Window(frame);
    41     Button button = new Button("button");
    42     Button button = new Button("button");
    42     AtomicBoolean focused = new AtomicBoolean(false);
    43     AtomicBoolean focused = new AtomicBoolean(false);
    43     Robot robot;
    44     Robot robot;
    44 
    45 
    45     public static void main(String[] args) {
    46     public static void main(String[] args) {
    46         WindowInitialFocusTest app = new WindowInitialFocusTest();
    47         WindowInitialFocusTest app = new WindowInitialFocusTest();
    47         app.init();
       
    48         app.start();
    48         app.start();
    49     }
       
    50 
       
    51     public void init() {
       
    52         // Create instructions for the user here, as well as set up
       
    53         // the environment -- set the layout manager, add buttons,
       
    54         // etc.
       
    55         this.setLayout (new BorderLayout ());
       
    56     }
    49     }
    57 
    50 
    58     public void start() {
    51     public void start() {
    59         frame.setBounds(800, 0, 200, 100);
    52         frame.setBounds(800, 0, 200, 100);
    60         window.setBounds(800, 200, 200, 100);
    53         window.setBounds(800, 200, 200, 100);