Skip to content

Commit 868168c

Browse files
committed
8328021: Convert applet test java/awt/List/SetFontTest/SetFontTest.html to main program
Backport-of: 87bd6caca03745c21172c3b5e8b0d28724810352
1 parent b002ba6 commit 868168c

File tree

3 files changed

+96
-277
lines changed

3 files changed

+96
-277
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
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
7+
* published by the Free Software Foundation.
8+
*
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+
/*
25+
@test
26+
@bug 5010944 6248072
27+
@summary List's rows overlap one another
28+
@library /java/awt/regtesthelpers
29+
@run main/manual SetFontTest
30+
*/
31+
32+
import java.awt.Button;
33+
import java.awt.FlowLayout;
34+
import java.awt.Font;
35+
import java.awt.Frame;
36+
import java.awt.List;
37+
import java.awt.event.ActionEvent;
38+
import java.awt.event.ActionListener;
39+
40+
public class SetFontTest {
41+
42+
static final String INSTRUCTIONS = """
43+
1) Click on the 'Enlarge font' button to enlarge font of the list.
44+
2) If you see that the rows of the list overlap one another
45+
then the test failed. Otherwise, go to step 3.
46+
3) Click on the 'Change mode' button to set multiple-selection mode.
47+
4) If you see that the rows of the list overlap one another
48+
then the test failed. Otherwise, the test passed.
49+
""";
50+
51+
public static void main(String[] args) throws Exception {
52+
PassFailJFrame.builder()
53+
.title("AWT List Font Test")
54+
.instructions(INSTRUCTIONS)
55+
.rows(10)
56+
.columns(40)
57+
.testUI(SetFontTest::createFontTest)
58+
.build()
59+
.awaitAndCheck();
60+
}
61+
62+
static Frame createFontTest() {
63+
64+
Frame frame = new Frame("List Font Test");
65+
List list = new List(8, false);
66+
Button button1 = new Button("Enlarge font");
67+
Button button2 = new Button("Change mode");
68+
69+
list.add("111");
70+
list.add("222");
71+
list.add("333");
72+
list.add("444");
73+
74+
button1.addActionListener(
75+
new ActionListener(){
76+
public void actionPerformed(ActionEvent ae) {
77+
list.setFont(new Font("SansSerif", Font.PLAIN, 30));
78+
list.repaint();
79+
}
80+
});
81+
82+
button2.addActionListener(
83+
new ActionListener(){
84+
public void actionPerformed(ActionEvent ae){
85+
list.setMultipleMode(true);
86+
}
87+
});
88+
89+
frame.setLayout(new FlowLayout());
90+
frame.add(list);
91+
frame.add(button1);
92+
frame.add(button2);
93+
frame.setSize(200, 250);
94+
return frame;
95+
}
96+
}

test/jdk/java/awt/List/SetFontTest/SetFontTest.html

Lines changed: 0 additions & 43 deletions
This file was deleted.

test/jdk/java/awt/List/SetFontTest/SetFontTest.java

Lines changed: 0 additions & 234 deletions
This file was deleted.

0 commit comments

Comments
 (0)