|
1 | 1 | /*
|
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. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
21 | 21 | * questions.
|
22 | 22 | */
|
23 | 23 |
|
| 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 | + |
24 | 33 | /*
|
25 | 34 | * @test
|
26 | 35 | * @bug 4760089
|
27 | 36 | * @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 |
30 | 40 | */
|
31 | 41 |
|
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 | + } |
37 | 58 |
|
38 |
| -public class Test4760089 extends JApplet { |
39 |
| - @Override |
40 |
| - public void init() { |
| 59 | + public static JComponent init() { |
41 | 60 | Border border = new EtchedBorder();
|
42 |
| - border = new TitledBorder(border, "LEFT", TitledBorder.LEFT, TitledBorder.TOP); |
| 61 | + border = new TitledBorder(border, "LEFT", TitledBorder.LEFT, TitledBorder.TOP); |
43 | 62 | border = new TitledBorder(border, "RIGHT", TitledBorder.RIGHT, TitledBorder.TOP);
|
44 | 63 |
|
45 | 64 | JPanel panel = new JPanel();
|
46 | 65 | 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; |
48 | 71 | }
|
49 | 72 | }
|
0 commit comments