Skip to content

Commit 437a53d

Browse files
committed
8345447: test/jdk/javax/swing/JToolBar/4529206/bug4529206.java fails in ubuntu22.04
Backport-of: 923321cfb1a9c66ca0e8f843ff029fd161a19b5b
1 parent 40fcb90 commit 437a53d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/jdk/javax/swing/JToolBar/4529206/bug4529206.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, 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
@@ -30,6 +30,7 @@
3030
import javax.swing.JTextField;
3131
import javax.swing.JToolBar;
3232
import javax.swing.SwingUtilities;
33+
import javax.swing.plaf.basic.BasicToolBarUI;
3334

3435
/*
3536
* @test
@@ -45,7 +46,7 @@ public class bug4529206 {
4546
static JButton jButton1;
4647

4748
private static void test() {
48-
frame = new JFrame();
49+
frame = new JFrame("bug4529206");
4950
JPanel jPanFrame = (JPanel) frame.getContentPane();
5051
jPanFrame.setLayout(new BorderLayout());
5152
frame.setSize(new Dimension(200, 100));
@@ -64,7 +65,7 @@ private static void test() {
6465
}
6566

6667
private static void makeToolbarFloat() {
67-
javax.swing.plaf.basic.BasicToolBarUI ui = (javax.swing.plaf.basic.BasicToolBarUI) jToolBar1.getUI();
68+
BasicToolBarUI ui = (BasicToolBarUI) jToolBar1.getUI();
6869
if (!ui.isFloating()) {
6970
ui.setFloatingLocation(100, 100);
7071
ui.setFloating(true, jToolBar1.getLocation());
@@ -79,16 +80,17 @@ public static void main(String[] args) throws Exception {
7980
try {
8081
SwingUtilities.invokeAndWait(() -> test());
8182
Robot robot = new Robot();
82-
robot.setAutoWaitForIdle(true);
83+
robot.waitForIdle();
8384
robot.delay(1000);
8485

8586
SwingUtilities.invokeAndWait(() -> makeToolbarFloat());
87+
robot.waitForIdle();
8688
robot.delay(300);
8789

8890
SwingUtilities.invokeAndWait(() -> {
8991
if (frame.isFocused()) {
90-
throw
91-
new RuntimeException("setFloating does not work correctly");
92+
throw new RuntimeException(
93+
"setFloating does not work correctly");
9294
}
9395
});
9496
} finally {

0 commit comments

Comments
 (0)