diff --git a/test/jdk/java/awt/Frame/DefaultSizeTest.java b/test/jdk/java/awt/Frame/DefaultSizeTest.java index 20fff704ec621..62080c3cb38f5 100644 --- a/test/jdk/java/awt/Frame/DefaultSizeTest.java +++ b/test/jdk/java/awt/Frame/DefaultSizeTest.java @@ -21,8 +21,8 @@ * questions. */ +import java.awt.EventQueue; import java.awt.Frame; -import javax.swing.SwingUtilities; /* * @test 4033151 @@ -39,7 +39,7 @@ public class DefaultSizeTest { It should be located to the right of this window and should be the minimum size allowed by the window manager. For any WM, the frame should be very small. - When the test is complete, click Pass or Fail as appropriate. + If the frame is not large, click Pass or Fail otherwise. """; @@ -52,7 +52,7 @@ public static void main(String[] args) throws Exception { .columns(45) .build(); - SwingUtilities.invokeAndWait(() -> { + EventQueue.invokeAndWait(() -> { Frame frame = new Frame("DefaultSize"); PassFailJFrame.addTestWindow(frame); diff --git a/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java b/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java index 0d1eacf9922f2..a6b1e3bc95c5b 100644 --- a/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java +++ b/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java @@ -25,11 +25,12 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Graphics; import java.awt.Rectangle; -import javax.swing.SwingUtilities; +import java.awt.Shape; /* * @test @@ -43,8 +44,8 @@ public class LightweightCliprect { private static final String INSTRUCTIONS = """ - If some text is drawn outside the red rectangle press "Fail" button. - Otherwise press "Pass" button. + If some text is drawn outside the red rectangle, press "Fail" button. + Otherwise, press "Pass" button. """; public static void main(String[] args) throws Exception { @@ -56,7 +57,7 @@ public static void main(String[] args) throws Exception { .columns(45) .build(); - SwingUtilities.invokeAndWait(() -> { + EventQueue.invokeAndWait(() -> { Frame frame = new Frame("DefaultSize"); Container panel = new MyContainer(); @@ -83,8 +84,7 @@ public void paint(Graphics g) { Color c = g.getColor(); g.setColor(Color.red); g.fillRect(20, 20, 400, 200); - Rectangle clip; - clip = g.getClipBounds(); + Shape clip = g.getClip(); g.setClip(20, 20, 400, 200); //draw the current java version in the component g.setColor(Color.black); diff --git a/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java b/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java index c947e771315ba..098000a8bab68 100644 --- a/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java +++ b/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java @@ -44,19 +44,9 @@ */ public class DefaultCloseOperation extends JPanel { - private static final String INSTRUCTIONS = """ - This is a manual test (requires user interaction) which tests the - "defaultCloseOperation" property for swing's JFrame and JDialog. - This property enables a program to tell swing to automatically - handle a user's "Close" operation on a JFrame or JDialog in one of - the following ways: - - - Do nothing - do not do anything when the user closes the window - - Hide - automatically hide the window when the user closes it - - Dispose - automatically dispose the window when the user closes it - To run this test, do the following steps (if an exception is thrown - at anytime during the test, the test has failed, else it passed): + private static final String INSTRUCTIONS = """ + Do the following steps: - Click the "Open Frame" button (a TestFrame will appear) - On the TestFrame, select "Close" from the system menu (the window should go away) @@ -88,7 +78,7 @@ public static void main(String[] args) throws Exception { .title("DefaultCloseOperation Manual Test") .instructions(INSTRUCTIONS) .testTimeOut(5) - .rows(33) + .rows(20) .columns(70) .build();