Skip to content

Commit ac5b6cb

Browse files
committed
8327757: Convert javax/swing/JSlider/6524424/bug6524424.java applet to main
Reviewed-by: abhiscxk, jdv
1 parent 652fb3a commit ac5b6cb

File tree

2 files changed

+43
-58
lines changed

2 files changed

+43
-58
lines changed

test/jdk/javax/swing/JSlider/6524424/bug6524424.html

Lines changed: 0 additions & 34 deletions
This file was deleted.

test/jdk/javax/swing/JSlider/6524424/bug6524424.java renamed to test/jdk/javax/swing/JSlider/bug6524424.java

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 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
@@ -21,46 +21,65 @@
2121
* questions.
2222
*/
2323

24-
/* @test
24+
/*
25+
* @test
2526
* @bug 6524424
2627
* @requires (os.family == "windows")
27-
* @summary JSlider Clicking In Tracks Behavior Inconsistent For Different Tick Spacings
28-
* @author Pavel Porvatov
28+
* @summary JSlider clicking in tracks behavior inconsistent for different tick spacings
2929
* @modules java.desktop/com.sun.java.swing.plaf.windows
30-
* @run applet/manual=done bug6524424.html
30+
* @library /java/awt/regtesthelpers
31+
* @build PassFailJFrame
32+
* @run main/manual bug6524424
3133
*/
3234

33-
import java.awt.*;
34-
import javax.swing.*;
35+
import java.awt.Component;
36+
import java.awt.GridBagConstraints;
37+
import java.awt.GridBagLayout;
38+
import java.awt.Insets;
39+
import javax.swing.JFrame;
40+
import javax.swing.JPanel;
41+
import javax.swing.JSlider;
42+
import javax.swing.SwingUtilities;
43+
import javax.swing.UIManager;
44+
import javax.swing.UnsupportedLookAndFeelException;
3545

3646
import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
3747

38-
public class bug6524424 extends JApplet {
39-
public static void main(String[] args) {
48+
public class bug6524424 {
49+
private static final String INSTRUCTIONS = """
50+
1. Select a slider (do the next steps for every slider)
51+
2. Check that the next keyboard buttons work correctly:
52+
Up, Down, Left, Right, Page Up, Page Down
53+
3. Press left mouse button on a free space of the slider
54+
check if thumb moves correctly
55+
press Pass else press Fail.""";
56+
57+
public static void main(String[] args) throws Exception {
58+
PassFailJFrame.builder()
59+
.title("Slider Behavior Instructions")
60+
.instructions(INSTRUCTIONS)
61+
.rows(7)
62+
.columns(30)
63+
.testUI(bug6524424::createTestUI)
64+
.build()
65+
.awaitAndCheck();
66+
}
67+
68+
private static JFrame createTestUI() {
4069
try {
4170
UIManager.setLookAndFeel(new WindowsLookAndFeel());
42-
} catch (UnsupportedLookAndFeelException e) {
43-
e.printStackTrace();
44-
45-
return;
71+
} catch (UnsupportedLookAndFeelException ex) {
72+
PassFailJFrame.forceFail(ex.toString());
73+
return null;
4674
}
4775

4876
TestPanel panel = new TestPanel();
4977

50-
JFrame frame = new JFrame();
78+
JFrame frame = new JFrame("bug6524424");
5179

5280
frame.setContentPane(panel);
53-
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
5481
frame.pack();
55-
frame.setLocationRelativeTo(null);
56-
57-
frame.setVisible(true);
58-
}
59-
60-
public void init() {
61-
TestPanel panel = new TestPanel();
62-
63-
setContentPane(panel);
82+
return frame;
6483
}
6584

6685
private static class TestPanel extends JPanel {

0 commit comments

Comments
 (0)