8327755: Convert javax/swing/JScrollBar/8039464/Test8039464.java applet to main

Reviewed-by: prr
This commit is contained in:
Prasanta Sadhukhan 2024-03-14 02:51:37 +00:00
parent 628e770274
commit 98e4b753e8
2 changed files with 24 additions and 53 deletions

View File

@ -1,32 +0,0 @@
<!--
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<body>
Choose the variable applet size and try to resize the applet.
The test passes the thumb is painted correctly.
<applet width="400" height="200" code="Test8039464">
</applet>
</body>
</html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,6 @@ import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollBar;
@ -37,11 +36,16 @@ import javax.swing.UIManager;
* @test
* @bug 8039464
* @summary Tests enabling/disabling of titled border's caption
* @author Sergey Malenkov
* @run applet/manual=yesno Test8039464.html
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
* @run main/manual Test8039464
*/
public class Test8039464 extends JApplet {
public class Test8039464 {
private static final String INSTRUCTIONS = """
If the scrollbar thumb is painted correctly in system lookandfeel
click Pass else click Fail. """;
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@ -50,11 +54,6 @@ public class Test8039464 extends JApplet {
}
}
@Override
public void init() {
init(this);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
@ -77,16 +76,20 @@ public class Test8039464 extends JApplet {
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JFrame frame = new JFrame("8039464");
init(frame);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
PassFailJFrame.builder()
.title("JScrollBar Instructions")
.instructions(INSTRUCTIONS)
.rows(5)
.columns(35)
.testUI(Test8039464::createTestUI)
.build()
.awaitAndCheck();
}
private static JFrame createTestUI() {
JFrame frame = new JFrame("8039464");
init(frame);
frame.pack();
return frame;
}
}