< prev index next >
test/jdk/javax/swing/JFrame/4962534/bug4962534.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -20,23 +20,23 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
- test
- @bug 4962534 7104594
+ @test
+ @key headful
+ @bug 4962534
@summary JFrame dances very badly
- @author dav@sparc.spb.su area=
- @run applet bug4962534.html
+ @run main bug4962534
*/
-import java.applet.Applet;
+
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
-public class bug4962534 extends Applet {
+public class bug4962534 {
Robot robot;
volatile Point framePosition;
volatile Point newFrameLocation;
JFrame frame;
@@ -44,11 +44,16 @@
Component titleComponent;
JLayeredPane lPane;
volatile boolean titleFound = false;
public static Object LOCK = new Object();
- @Override
+ public static void main(final String[] args) {
+ bug4962534 app = new bug4962534();
+ app.init();
+ app.start();
+ }
+
public void init() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
@@ -58,14 +63,11 @@
} catch (Exception ex) {
throw new RuntimeException("Init failed. " + ex.getMessage());
}
}//End init()
- @Override
public void start() {
- validate();
-
try {
setJLayeredPaneEDT();
setTitleComponentEDT();
} catch (Exception ex) {
ex.printStackTrace();
@@ -147,10 +149,11 @@
}
JFrame.setDefaultLookAndFeelDecorated(true);
frame = new JFrame("JFrame Dance Test");
frame.pack();
frame.setSize(450, 260);
+ frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
private void setJLayeredPaneEDT() throws Exception {
< prev index next >