Skip to content

Commit 9512e53

Browse files
committed
8327879: Convert javax/swing/border/Test4760089.java applet test to main
Backport-of: a68f5d7331c2e6c4bc51eee95abcbabb5a19b484
1 parent d0f905c commit 9512e53

File tree

2 files changed

+36
-46
lines changed

2 files changed

+36
-46
lines changed

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

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

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

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

24+
import java.awt.Dimension;
25+
import javax.swing.BorderFactory;
26+
import javax.swing.Box;
27+
import javax.swing.JComponent;
28+
import javax.swing.JPanel;
29+
import javax.swing.border.Border;
30+
import javax.swing.border.EtchedBorder;
31+
import javax.swing.border.TitledBorder;
32+
2433
/*
2534
* @test
2635
* @bug 4760089
2736
* @summary Tests that titled border do not paint inner titled border over its caption
28-
* @author Sergey Malenkov
29-
* @run applet/manual=yesno Test4760089.html
37+
* @library /java/awt/regtesthelpers
38+
* @build PassFailJFrame
39+
* @run main/manual Test4760089
3040
*/
3141

32-
import javax.swing.JApplet;
33-
import javax.swing.JPanel;
34-
import javax.swing.border.Border;
35-
import javax.swing.border.EtchedBorder;
36-
import javax.swing.border.TitledBorder;
42+
public class Test4760089 {
43+
public static void main(String[] args) throws Exception {
44+
String testInstructions = """
45+
When test starts, a panel with a compound titled border is seen.
46+
If one of its titles is overstruck with the border's
47+
line then test fails. Otherwise test passes.""";
48+
49+
PassFailJFrame.builder()
50+
.title("Test Instructions")
51+
.instructions(testInstructions)
52+
.rows(4)
53+
.columns(35)
54+
.splitUI(Test4760089::init)
55+
.build()
56+
.awaitAndCheck();
57+
}
3758

38-
public class Test4760089 extends JApplet {
39-
@Override
40-
public void init() {
59+
public static JComponent init() {
4160
Border border = new EtchedBorder();
42-
border = new TitledBorder(border, "LEFT", TitledBorder.LEFT, TitledBorder.TOP);
61+
border = new TitledBorder(border, "LEFT", TitledBorder.LEFT, TitledBorder.TOP);
4362
border = new TitledBorder(border, "RIGHT", TitledBorder.RIGHT, TitledBorder.TOP);
4463

4564
JPanel panel = new JPanel();
4665
panel.setBorder(border);
47-
getContentPane().add(panel);
66+
panel.setPreferredSize(new Dimension(200, 100));
67+
Box main = Box.createVerticalBox();
68+
main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
69+
main.add(panel);
70+
return main;
4871
}
4972
}

0 commit comments

Comments
 (0)