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
3030import javax .swing .JTextField ;
3131import javax .swing .JToolBar ;
3232import 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