Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Dec 17, 2024
1 parent 8de0622 commit d33aa49
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,20 @@
import javax.swing.JFrame;
import javax.swing.JScrollBar;
import javax.swing.SwingUtilities;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.concurrent.CountDownLatch;

import java.util.Date;

public class bug4865918 {

private static TestScrollBar sbar;
private static JFrame frame;
private static volatile CountDownLatch latch;

public static void main(String[] argv) throws Exception {
latch = new CountDownLatch(1);
try {
Robot robot = new Robot();
SwingUtilities.invokeAndWait(() -> createAndShowGUI());
Expand All @@ -52,6 +56,7 @@ public static void main(String[] argv) throws Exception {
robot.delay(1000);

SwingUtilities.invokeAndWait(() -> sbar.pressMouse());
latch.await();

robot.waitForIdle();
robot.delay(200);
Expand Down Expand Up @@ -81,6 +86,11 @@ private static void createAndShowGUI() {
sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100);
sbar.setPreferredSize(new Dimension(200, 20));
sbar.setBlockIncrement(10);
sbar.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
latch.countDown();
}
});

frame.getContentPane().add(sbar);
frame.pack();
Expand Down

0 comments on commit d33aa49

Please sign in to comment.