test/jdk/java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java
changeset 54231 e4813eded7cb
parent 50834 9cf279436b9d
equal deleted inserted replaced
54230:d9d9655bb077 54231:e4813eded7cb
    24 /*
    24 /*
    25   @test
    25   @test
    26   @key headful
    26   @key headful
    27   @bug       6496958
    27   @bug       6496958
    28   @summary   Tests that breaking the proccess of clearing LW requests doesn't break focus.
    28   @summary   Tests that breaking the proccess of clearing LW requests doesn't break focus.
    29   @author    anton.tarasov@...: area=awt-focus
       
    30   @library    ../../regtesthelpers
    29   @library    ../../regtesthelpers
    31   @build      Util
    30   @build      Util
    32   @run       main ClearLwQueueBreakTest
    31   @run       main ClearLwQueueBreakTest
    33 */
    32 */
    34 
    33 
    35 import java.awt.*;
    34 import java.awt.*;
    36 import javax.swing.*;
    35 import javax.swing.*;
    37 import java.awt.event.*;
    36 import java.awt.event.*;
    38 import java.applet.Applet;
       
    39 import test.java.awt.regtesthelpers.Util;
    37 import test.java.awt.regtesthelpers.Util;
    40 import java.util.concurrent.atomic.AtomicBoolean;
    38 import java.util.concurrent.atomic.AtomicBoolean;
    41 
    39 
    42 public class ClearLwQueueBreakTest extends Applet {
    40 public class ClearLwQueueBreakTest {
    43     JFrame f1 = new JFrame("frame");
    41     JFrame f1 = new JFrame("frame");
    44     JFrame f2 = new JFrame("frame");
    42     JFrame f2 = new JFrame("frame");
    45     JButton b = new JButton("button");
    43     JButton b = new JButton("button");
    46     JTextField tf1 = new JTextField("     ");
    44     JTextField tf1 = new JTextField("     ");
    47     JTextField tf2 = new JTextField("     ");
    45     JTextField tf2 = new JTextField("     ");
    58         app.start();
    56         app.start();
    59     }
    57     }
    60 
    58 
    61     public void init() {
    59     public void init() {
    62         robot = Util.createRobot();
    60         robot = Util.createRobot();
    63 
       
    64         // Create instructions for the user here, as well as set up
       
    65         // the environment -- set the layout manager, add buttons,
       
    66         // etc.
       
    67         this.setLayout (new BorderLayout ());
       
    68     }
    61     }
    69 
    62 
    70     public void start() {
    63     public void start() {
    71         b.addActionListener(new ActionListener() {
    64         b.addActionListener(new ActionListener() {
    72                 public void actionPerformed(ActionEvent e) {
    65                 public void actionPerformed(ActionEvent e) {
   116         f1.add(tf1);
   109         f1.add(tf1);
   117         f1.add(tf2);
   110         f1.add(tf2);
   118         f1.add(tf3);
   111         f1.add(tf3);
   119         f1.setLayout(new FlowLayout());
   112         f1.setLayout(new FlowLayout());
   120         f1.pack();
   113         f1.pack();
       
   114         f1.setLocationRelativeTo(null);
   121         f1.setVisible(true);
   115         f1.setVisible(true);
   122         Util.waitForIdle(robot);
   116         Util.waitForIdle(robot);
   123 
   117 
   124         /*
   118         /*
   125          * Break the sequence of LW requests in the middle.
   119          * Break the sequence of LW requests in the middle.