equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
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 4962534 7104594 |
26 @key headful |
27 @summary JFrame dances very badly |
27 @bug 4962534 |
28 @author dav@sparc.spb.su area= |
28 @summary JFrame dances very badly |
29 @run applet bug4962534.html |
29 @run main bug4962534 |
30 */ |
30 */ |
31 import java.applet.Applet; |
31 |
32 import java.awt.*; |
32 import java.awt.*; |
33 import java.awt.event.*; |
33 import java.awt.event.*; |
34 import java.util.Random; |
34 import java.util.Random; |
35 import javax.swing.*; |
35 import javax.swing.*; |
36 |
36 |
37 public class bug4962534 extends Applet { |
37 public class bug4962534 { |
38 |
38 |
39 Robot robot; |
39 Robot robot; |
40 volatile Point framePosition; |
40 volatile Point framePosition; |
41 volatile Point newFrameLocation; |
41 volatile Point newFrameLocation; |
42 JFrame frame; |
42 JFrame frame; |
44 Component titleComponent; |
44 Component titleComponent; |
45 JLayeredPane lPane; |
45 JLayeredPane lPane; |
46 volatile boolean titleFound = false; |
46 volatile boolean titleFound = false; |
47 public static Object LOCK = new Object(); |
47 public static Object LOCK = new Object(); |
48 |
48 |
49 @Override |
49 public static void main(final String[] args) { |
|
50 bug4962534 app = new bug4962534(); |
|
51 app.init(); |
|
52 app.start(); |
|
53 } |
|
54 |
50 public void init() { |
55 public void init() { |
51 try { |
56 try { |
52 SwingUtilities.invokeAndWait(new Runnable() { |
57 SwingUtilities.invokeAndWait(new Runnable() { |
53 @Override |
58 @Override |
54 public void run() { |
59 public void run() { |
58 } catch (Exception ex) { |
63 } catch (Exception ex) { |
59 throw new RuntimeException("Init failed. " + ex.getMessage()); |
64 throw new RuntimeException("Init failed. " + ex.getMessage()); |
60 } |
65 } |
61 }//End init() |
66 }//End init() |
62 |
67 |
63 @Override |
|
64 public void start() { |
68 public void start() { |
65 validate(); |
|
66 |
|
67 try { |
69 try { |
68 setJLayeredPaneEDT(); |
70 setJLayeredPaneEDT(); |
69 setTitleComponentEDT(); |
71 setTitleComponentEDT(); |
70 } catch (Exception ex) { |
72 } catch (Exception ex) { |
71 ex.printStackTrace(); |
73 ex.printStackTrace(); |
147 } |
149 } |
148 JFrame.setDefaultLookAndFeelDecorated(true); |
150 JFrame.setDefaultLookAndFeelDecorated(true); |
149 frame = new JFrame("JFrame Dance Test"); |
151 frame = new JFrame("JFrame Dance Test"); |
150 frame.pack(); |
152 frame.pack(); |
151 frame.setSize(450, 260); |
153 frame.setSize(450, 260); |
|
154 frame.setLocationRelativeTo(null); |
152 frame.setVisible(true); |
155 frame.setVisible(true); |
153 } |
156 } |
154 |
157 |
155 private void setJLayeredPaneEDT() throws Exception { |
158 private void setJLayeredPaneEDT() throws Exception { |
156 |
159 |