author | mfang |
Wed, 17 Aug 2011 14:18:26 -0700 | |
changeset 10294 | 8fcdae2a7ec7 |
parent 5506 | 202f599c92aa |
child 27763 | 1fba965925e8 |
permissions | -rw-r--r-- |
3087
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
1 |
/* |
5506 | 2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
3087
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
4 |
* |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
8 |
* |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
13 |
* accompanied this code). |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
14 |
* |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
18 |
* |
5506 | 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. |
|
3087
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
22 |
*/ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
23 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
24 |
/* |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
25 |
test |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
26 |
@bug 5004032 |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
27 |
@summary GridBagConstraints.ipad(x|y) defined in a new way |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
28 |
@author dav@sparc.spb.su area= |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
29 |
@run applet GridBagLayoutIpadXYTest.html |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
30 |
*/ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
31 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
32 |
import java.applet.Applet; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
33 |
import java.awt.*; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
34 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
35 |
public class GridBagLayoutIpadXYTest extends Applet |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
36 |
{ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
37 |
Frame frame = new Frame(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
38 |
TextField jtf = null; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
39 |
final int customIpadx = 300; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
40 |
final int customIpady = 40; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
41 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
42 |
public void init() |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
43 |
{ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
44 |
this.setLayout (new BorderLayout ()); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
45 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
46 |
String[] instructions = |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
47 |
{ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
48 |
"This is an AUTOMATIC test", |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
49 |
"simply wait until it is done" |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
50 |
}; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
51 |
}//End init() |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
52 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
53 |
public void start () |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
54 |
{ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
55 |
validate(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
56 |
frame.setLayout(new GridBagLayout()); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
57 |
GridBagConstraints gc = new GridBagConstraints(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
58 |
Insets fieldInsets = new Insets(0,5,5,0); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
59 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
60 |
gc.anchor = gc.NORTH; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
61 |
gc.fill = gc.HORIZONTAL; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
62 |
gc.gridx = 1; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
63 |
gc.gridy = 0; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
64 |
gc.weightx = 1; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
65 |
gc.ipadx = customIpadx; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
66 |
gc.ipady = customIpady; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
67 |
gc.insets = fieldInsets; |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
68 |
jtf = new TextField(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
69 |
frame.add(jtf, gc); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
70 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
71 |
frame.pack(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
72 |
frame.setVisible(true); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
73 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
74 |
((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
75 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
76 |
Dimension minSize = jtf.getMinimumSize(); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
77 |
if ( minSize.width + customIpadx != jtf.getSize().width || |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
78 |
minSize.height + customIpady != jtf.getSize().height ){ |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
79 |
System.out.println("TextField originally has min size = " + jtf.getMinimumSize()); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
80 |
System.out.println("TextField supplied with ipadx = 300, ipady =40"); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
81 |
System.out.println("Frame size: " + frame.getSize()); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
82 |
System.out.println(" Fields's size is "+jtf.getSize()); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
83 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
84 |
throw new RuntimeException("Test Failed. TextField has incorrect width. "); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
85 |
} |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
86 |
System.out.println("Test Passed."); |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
87 |
|
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
88 |
}// start() |
e5f156d403ad
6851646: test/closed/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java can fail
anthony
parents:
diff
changeset
|
89 |
} |