Skip to content

Commit 9655084

Browse files
committed
8346839: [TESTBUG] "java/awt/textfield/setechochartest4/setechochartest4.java" failed because the test frame disappears on clicking "Click Several Times" button
Backport-of: 58270b757c0bdf82bf753fa304b829e3b64196e4
1 parent cdfbe3b commit 9655084

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

test/jdk/java/awt/TextField/SetEchoCharTest4/SetEchoCharTest4.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@
2727
import java.awt.TextField;
2828
import java.awt.event.ActionEvent;
2929
import java.awt.event.ActionListener;
30-
import java.lang.reflect.InvocationTargetException;
3130

3231
/*
3332
* @test
@@ -54,16 +53,17 @@ public class SetEchoCharTest4 extends Frame implements ActionListener {
5453
5554
Make sure the actual text matches what you typed in for each field.
5655
Press Pass if everything's ok, otherwise Fail
57-
""";
56+
""";
5857

5958
public SetEchoCharTest4() {
59+
super("SetEchoCharTest4");
6060
setLayout(new FlowLayout());
6161
tf1.setEchoChar('*');
6262
tf2.setEchoChar('$');
6363
tf3.setEchoChar('#');
6464
addStuff();
6565
b.addActionListener(this);
66-
setSize (200,200);
66+
setSize (300, 150);
6767
}
6868

6969
private void addStuff() {
@@ -78,24 +78,21 @@ public void actionPerformed(ActionEvent ae) {
7878
PassFailJFrame.log("TextField2 = " + tf2.getText());
7979
PassFailJFrame.log("TextField3 = " + tf3.getText());
8080
PassFailJFrame.log("--------------");
81-
setVisible(false);
8281
remove(tf1);
8382
remove(tf2);
8483
remove(tf3);
8584
remove(b);
8685
addStuff();
8786
}
8887

89-
public static void main(String[] args) throws InterruptedException,
90-
InvocationTargetException {
88+
public static void main(String[] args) throws Exception {
9189
PassFailJFrame.builder()
92-
.title("Set Echo Character Test")
93-
.testUI(SetEchoCharTest4::new)
94-
.instructions(INSTRUCTIONS)
95-
.rows((int) INSTRUCTIONS.lines().count() + 1)
96-
.columns(40)
97-
.logArea()
98-
.build()
99-
.awaitAndCheck();
90+
.title("Set Echo Character Test")
91+
.testUI(SetEchoCharTest4::new)
92+
.instructions(INSTRUCTIONS)
93+
.columns(40)
94+
.logArea()
95+
.build()
96+
.awaitAndCheck();
10097
}
10198
}

0 commit comments

Comments
 (0)