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 @test
25 @key headful
26 @bug 6399679
27 @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
28 @author andrei.dmitriev area=awt.choice
29 @library ../../../../lib/testlibrary
30 @build jdk.testlibrary.OSInfo
31 @run main ResizeAutoClosesChoice
32 */
33
34 import java.awt.*;
35 import java.awt.event.*;
36
37 import jdk.testlibrary.OSInfo;
38
39 public class ResizeAutoClosesChoice
40 {
41 static Frame frame = new Frame("Test Frame");
42 static Choice choice1 = new Choice();
43 static Robot robot;
44 static Point pt;
45 static String passed = null;
46 static Button button = new Button("This button causes Frame to be resized on pack()");
47 public static void main(String args[]) throws Exception
48 {
49 if(OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
50 System.out.println("Not for OS OX");
51 return;
52 }
53
54 choice1.setForeground(Color.red);
55 choice1.setBackground(Color.red);
56
57 frame.setLayout (new BorderLayout ());
58 for (int i = 1; i<10;i++){
59 choice1.add("item "+i);
60 }
61 frame.setSize(300, 300);
62 choice1.setLocation(50, 50);
63 choice1.setSize(70, 20);
64
65 button.setLocation(150, 100);
66 button.setSize(150, 20);
67 frame.add(choice1, BorderLayout.SOUTH);
68 frame.pack();
69
|
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 @test
25 @key headful
26 @bug 6399679
27 @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
28 @author andrei.dmitriev area=awt.choice
29 @library /test/lib
30 @build jdk.test.lib.Platform
31 @run main ResizeAutoClosesChoice
32 */
33
34 import java.awt.*;
35 import java.awt.event.*;
36
37 import jdk.test.lib.Platform;
38
39 public class ResizeAutoClosesChoice
40 {
41 static Frame frame = new Frame("Test Frame");
42 static Choice choice1 = new Choice();
43 static Robot robot;
44 static Point pt;
45 static String passed = null;
46 static Button button = new Button("This button causes Frame to be resized on pack()");
47 public static void main(String args[]) throws Exception
48 {
49 if (Platform.isOSX()) {
50 System.out.println("Not for OS OX");
51 return;
52 }
53
54 choice1.setForeground(Color.red);
55 choice1.setBackground(Color.red);
56
57 frame.setLayout (new BorderLayout ());
58 for (int i = 1; i<10;i++){
59 choice1.add("item "+i);
60 }
61 frame.setSize(300, 300);
62 choice1.setLocation(50, 50);
63 choice1.setSize(70, 20);
64
65 button.setLocation(150, 100);
66 button.setSize(150, 20);
67 frame.add(choice1, BorderLayout.SOUTH);
68 frame.pack();
69
|