1 /* @test
2 @bug 4103095
3 @summary Test for getBounds() after a Frame resize.
4 @author andrei.dmitriev : area=awt.toplevel
5 @run main/manual GetBoundsResizeTest
6 */
7
8 import java.applet.Applet;
9 import java.lang.*;
10 import java.awt.*;
11 import java.awt.event.*;
12 import sun.awt.SunToolkit;
13
14 class Globals {
15 static boolean testPassed=false;
16 static Thread mainThread=null;
17 }
18
19 public class GetBoundsResizeTest extends Applet {
20
21 public static void main(String args[]) throws Exception {
22 GetBoundsResizeTest app = new GetBoundsResizeTest();
23 app.start();
24 Globals.mainThread = Thread.currentThread();
25 try {
26 Thread.sleep(300000);
27 } catch (InterruptedException e) {
28 if (!Globals.testPassed)
29 throw new Exception("GetBoundsResizeTest failed.");
30 }
31 }
32
111 GetBoundsResizeTester(String name)
112 {
113 super(name);
114 final Frame f = this;
115 Panel p = new Panel();
116 f.add(p);
117 p.setLayout(new BorderLayout());
118 b.addActionListener(new ActionListener() {
119 public void actionPerformed(ActionEvent be){
120 Point cp = b.getLocationOnScreen();
121 TestDialog.output.append("Current Frame.getBounds() = " + f.getBounds()+"\n");
122 }
123 });
124 p.add("Center", b);
125 f.pack();
126 }
127
128 public void start ()
129 {
130 setVisible(true);
131 SunToolkit tk = (SunToolkit)(Toolkit.getDefaultToolkit());
132 tk.realSync();
133 Point cp = b.getLocationOnScreen();
134 TestDialog.output.append("Original Frame.getBounds() = " + this.getBounds()+"\n");
135 }
136
137 public static void main(String[] args)
138 {
139 new GetBoundsResizeTester("GetBoundsResizeTester").start();
140 }
141
142 }
|
1 /* @test
2 @bug 4103095
3 @summary Test for getBounds() after a Frame resize.
4 @author andrei.dmitriev : area=awt.toplevel
5 @run main/manual GetBoundsResizeTest
6 */
7
8 import java.applet.Applet;
9 import java.lang.*;
10 import java.awt.*;
11 import java.awt.event.*;
12
13 class Globals {
14 static boolean testPassed=false;
15 static Thread mainThread=null;
16 }
17
18 public class GetBoundsResizeTest extends Applet {
19
20 public static void main(String args[]) throws Exception {
21 GetBoundsResizeTest app = new GetBoundsResizeTest();
22 app.start();
23 Globals.mainThread = Thread.currentThread();
24 try {
25 Thread.sleep(300000);
26 } catch (InterruptedException e) {
27 if (!Globals.testPassed)
28 throw new Exception("GetBoundsResizeTest failed.");
29 }
30 }
31
110 GetBoundsResizeTester(String name)
111 {
112 super(name);
113 final Frame f = this;
114 Panel p = new Panel();
115 f.add(p);
116 p.setLayout(new BorderLayout());
117 b.addActionListener(new ActionListener() {
118 public void actionPerformed(ActionEvent be){
119 Point cp = b.getLocationOnScreen();
120 TestDialog.output.append("Current Frame.getBounds() = " + f.getBounds()+"\n");
121 }
122 });
123 p.add("Center", b);
124 f.pack();
125 }
126
127 public void start ()
128 {
129 setVisible(true);
130 Robot robot;
131 try {
132 robot = new Robot();
133 robot.waitForIdle();
134 }catch(Exception ignorex) {
135 }
136 Point cp = b.getLocationOnScreen();
137 TestDialog.output.append("Original Frame.getBounds() = " + this.getBounds()+"\n");
138 }
139
140 public static void main(String[] args)
141 {
142 new GetBoundsResizeTester("GetBoundsResizeTester").start();
143 }
144
145 }
|