Skip to content

Commit 9d4f3b7

Browse files
committed
8327873: Convert javax/swing/border/Test4247606.java applet test to main
Backport-of: d4ec783108828efd158c749f37e4220bb1df86fc
1 parent 9bd32e8 commit 9d4f3b7

File tree

2 files changed

+34
-48
lines changed

2 files changed

+34
-48
lines changed

test/jdk/javax/swing/border/Test4247606.html

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

test/jdk/javax/swing/border/Test4247606.java

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

24-
/*
25-
* @test
26-
* @bug 4247606
27-
* @summary BorderedPane appears wrong with Title Position Below Bottom
28-
* @author Andrey Pikalev
29-
* @run applet/manual=yesno Test4247606.html
30-
*/
31-
3224
import java.awt.BorderLayout;
3325
import java.awt.Color;
26+
import java.awt.Dimension;
3427
import javax.swing.BorderFactory;
35-
import javax.swing.JApplet;
3628
import javax.swing.JButton;
3729
import javax.swing.JComponent;
3830
import javax.swing.JPanel;
3931
import javax.swing.border.Border;
4032
import javax.swing.border.TitledBorder;
4133

42-
public class Test4247606 extends JApplet {
43-
public void init() {
44-
JButton button = new JButton("Button"); // NON-NLS: the button text
34+
/*
35+
* @test
36+
* @bug 4247606
37+
* @summary BorderedPane appears wrong with title position below bottom
38+
* @library /java/awt/regtesthelpers
39+
* @build PassFailJFrame
40+
* @run main/manual Test4247606
41+
*/
42+
43+
public class Test4247606 {
44+
public static void main(String[] args) throws Exception {
45+
String testInstructions = """
46+
If the button does not fit into the titled border bounds
47+
and cover the bottom border's line then test fails.
48+
Otherwise test passes
49+
""";
50+
51+
PassFailJFrame.builder()
52+
.title("Test Instructions")
53+
.instructions(testInstructions)
54+
.rows(4)
55+
.columns(35)
56+
.splitUI(Test4247606::initializeTest)
57+
.build()
58+
.awaitAndCheck();
59+
}
60+
61+
public static JComponent initializeTest() {
62+
JButton button = new JButton("Button");
4563
button.setBorder(BorderFactory.createLineBorder(Color.red, 1));
4664

47-
TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
65+
TitledBorder border = new TitledBorder("Bordered Pane");
4866
border.setTitlePosition(TitledBorder.BELOW_BOTTOM);
4967

5068
JPanel panel = create(button, border);
5169
panel.setBackground(Color.green);
70+
panel.setPreferredSize(new Dimension(200, 150));
5271

53-
getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
72+
return create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10));
5473
}
5574

5675
private static JPanel create(JComponent component, Border border) {

0 commit comments

Comments
 (0)