< prev index next >

test/jdk/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   @test
  26   @key headful
  27   @bug       6187066
  28   @summary   Tests the Window.autoRequestFocus property for the Window.setVisible() method.
  29   @author    anton.tarasov: area=awt.focus
  30   @library    ../../regtesthelpers
  31   @build      Util
  32   @run       main AutoRequestFocusSetVisibleTest
  33 */
  34 
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 import java.applet.Applet;
  38 import java.util.concurrent.atomic.AtomicBoolean;
  39 import java.lang.reflect.InvocationTargetException;
  40 import test.java.awt.regtesthelpers.Util;
  41 
  42 public class AutoRequestFocusSetVisibleTest extends Applet {
  43     static Frame focusedFrame;
  44     static Button focusOwner;
  45     static Frame frame;
  46     static Button frameButton;
  47     static Frame frame2;
  48     static Button frameButton2;
  49     static Window window;
  50     static Button winButton;
  51     static Window ownedWindow;
  52     static Button ownWinButton;
  53     static Dialog ownedDialog;
  54     static Button ownDlgButton;
  55     static Dialog dialog;
  56     static Button dlgButton;
  57 
  58     static String toolkitClassName;
  59     static Robot robot = Util.createRobot();
  60 
  61     public static void main(String[] args) {
  62         AutoRequestFocusSetVisibleTest app = new AutoRequestFocusSetVisibleTest();
  63         app.init();
  64         app.start();
  65     }
  66 
  67     public void init() {
  68         // Create instructions for the user here, as well as set up
  69         // the environment -- set the layout manager, add buttons,
  70         // etc.
  71         this.setLayout (new BorderLayout ());
  72         toolkitClassName = Toolkit.getDefaultToolkit().getClass().getName();
  73     }
  74 
  75     void recreateGUI() {
  76         if (focusedFrame != null) {
  77             focusedFrame.dispose();
  78             frame.dispose();
  79             frame2.dispose();
  80             window.dispose();
  81             ownedWindow.dispose();
  82             ownedDialog.dispose();
  83             dialog.dispose();
  84         }
  85 
  86         focusedFrame = new Frame("Base Frame");
  87         focusOwner = new Button("button");
  88 
  89         frame = new Frame("Test Frame");
  90         frameButton = new Button("button");
  91 




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25   @test
  26   @key headful
  27   @bug       6187066
  28   @summary   Tests the Window.autoRequestFocus property for the Window.setVisible() method.

  29   @library    ../../regtesthelpers
  30   @build      Util
  31   @run       main AutoRequestFocusSetVisibleTest
  32 */
  33 
  34 import java.awt.*;




  35 import test.java.awt.regtesthelpers.Util;
  36 
  37 public class AutoRequestFocusSetVisibleTest {
  38     static Frame focusedFrame;
  39     static Button focusOwner;
  40     static Frame frame;
  41     static Button frameButton;
  42     static Frame frame2;
  43     static Button frameButton2;
  44     static Window window;
  45     static Button winButton;
  46     static Window ownedWindow;
  47     static Button ownWinButton;
  48     static Dialog ownedDialog;
  49     static Button ownDlgButton;
  50     static Dialog dialog;
  51     static Button dlgButton;
  52 
  53     static String toolkitClassName;
  54     static Robot robot = Util.createRobot();
  55 
  56     public static void main(String[] args) {
  57         AutoRequestFocusSetVisibleTest app = new AutoRequestFocusSetVisibleTest();
  58         app.init();
  59         app.start();
  60     }
  61 
  62     public void init() {




  63         toolkitClassName = Toolkit.getDefaultToolkit().getClass().getName();
  64     }
  65 
  66     void recreateGUI() {
  67         if (focusedFrame != null) {
  68             focusedFrame.dispose();
  69             frame.dispose();
  70             frame2.dispose();
  71             window.dispose();
  72             ownedWindow.dispose();
  73             ownedDialog.dispose();
  74             dialog.dispose();
  75         }
  76 
  77         focusedFrame = new Frame("Base Frame");
  78         focusOwner = new Button("button");
  79 
  80         frame = new Frame("Test Frame");
  81         frameButton = new Button("button");
  82 


< prev index next >