Skip to content

Commit 1799d23

Browse files
committed
8327826: Convert javax/swing/border/Test4243289.java applet test to main
Backport-of: a43c3cc3476f18c048809bcd08f81fc4288ca399
1 parent 9b3765f commit 1799d23

File tree

2 files changed

+36
-45
lines changed

2 files changed

+36
-45
lines changed

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

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

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

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

24+
import java.awt.Dimension;
25+
import java.awt.Font;
26+
import javax.swing.BorderFactory;
27+
import javax.swing.Box;
28+
import javax.swing.JComponent;
29+
import javax.swing.JPanel;
30+
import javax.swing.border.TitledBorder;
31+
2432
/*
2533
* @test
2634
* @bug 4243289
2735
* @summary Tests that TitledBorder do not draw line through its caption
28-
* @author Peter Zhelezniakov
29-
* @run applet/manual=yesno Test4243289.html
36+
* @library /java/awt/regtesthelpers
37+
* @build PassFailJFrame
38+
* @run main/manual Test4243289
3039
*/
3140

32-
import java.awt.Font;
33-
import javax.swing.BorderFactory;
34-
import javax.swing.JApplet;
35-
import javax.swing.JPanel;
36-
import javax.swing.border.TitledBorder;
41+
public class Test4243289 {
42+
public static void main(String[] args) throws Exception {
43+
String testInstructions = """
44+
If TitledBorder with title "Panel Title" is overstruck with
45+
the border line, test fails, otherwise it passes.
46+
""";
47+
48+
PassFailJFrame.builder()
49+
.title("Test Instructions")
50+
.instructions(testInstructions)
51+
.rows(3)
52+
.columns(35)
53+
.splitUI(Test4243289::init)
54+
.build()
55+
.awaitAndCheck();
56+
}
3757

38-
public class Test4243289 extends JApplet {
39-
public void init() {
40-
Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name
58+
public static JComponent init() {
59+
Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
4160
TitledBorder border = BorderFactory.createTitledBorder(
4261
BorderFactory.createEtchedBorder(),
43-
"Panel Title", // NON-NLS: the title of the border
62+
"Panel Title",
4463
TitledBorder.DEFAULT_JUSTIFICATION,
4564
TitledBorder.DEFAULT_POSITION,
4665
font);
4766

4867
JPanel panel = new JPanel();
4968
panel.setBorder(border);
50-
getContentPane().add(panel);
69+
panel.setPreferredSize(new Dimension(100, 100));
70+
Box main = Box.createVerticalBox();
71+
main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
72+
main.add(panel);
73+
return main;
5174
}
5275
}

0 commit comments

Comments
 (0)