|
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 |
|
27 | 27 | import java.awt.Graphics; |
28 | 28 | import java.awt.Insets; |
29 | 29 | import javax.swing.Icon; |
30 | | -import javax.swing.JApplet; |
31 | 30 | import javax.swing.JButton; |
| 31 | +import javax.swing.JFrame; |
32 | 32 | import javax.swing.JScrollPane; |
33 | 33 | import javax.swing.JSplitPane; |
34 | 34 | import javax.swing.border.MatteBorder; |
|
37 | 37 | * @test |
38 | 38 | * @bug 6910490 |
39 | 39 | * @summary Tests a matte border around a component inside a scroll pane. |
40 | | - * @author Sergey Malenkov |
41 | | - * @run applet/manual=yesno Test6910490.html |
| 40 | + * @library /java/awt/regtesthelpers |
| 41 | + * @build PassFailJFrame |
| 42 | + * @run main/manual Test6910490 |
42 | 43 | */ |
43 | 44 |
|
44 | | -public class Test6910490 extends JApplet implements Icon { |
| 45 | +public class Test6910490 implements Icon { |
| 46 | + public static void main(String[] args) throws Exception { |
| 47 | + String testInstructions = """ |
| 48 | + If the border is painted over scroll bars then test fails. |
| 49 | + Otherwise test passes."""; |
| 50 | + Test6910490 obj = new Test6910490(); |
| 51 | + PassFailJFrame.builder() |
| 52 | + .title("Test Instructions") |
| 53 | + .instructions(testInstructions) |
| 54 | + .rows(3) |
| 55 | + .columns(35) |
| 56 | + .testUI(obj.initializeTest()) |
| 57 | + .build() |
| 58 | + .awaitAndCheck(); |
| 59 | + } |
45 | 60 |
|
46 | | - @Override |
47 | | - public void init() { |
| 61 | + public JFrame initializeTest() { |
48 | 62 | Insets insets = new Insets(10, 10, 10, 10); |
49 | | - Dimension size = new Dimension(getWidth() / 2, getHeight()); |
| 63 | + JFrame frame = new JFrame("Matte Border Test"); |
| 64 | + frame.setSize(600, 300); |
| 65 | + Dimension size = new Dimension(frame.getWidth() / 2, frame.getHeight()); |
50 | 66 | JSplitPane pane = new JSplitPane( |
51 | 67 | JSplitPane.HORIZONTAL_SPLIT, |
52 | 68 | create("Color", size, new MatteBorder(insets, RED)), |
53 | 69 | create("Icon", size, new MatteBorder(insets, this))); |
| 70 | + |
54 | 71 | pane.setDividerLocation(size.width - pane.getDividerSize() / 2); |
55 | | - add(pane); |
| 72 | + frame.add(pane); |
| 73 | + return frame; |
56 | 74 | } |
57 | 75 |
|
58 | 76 | private JScrollPane create(String name, Dimension size, MatteBorder border) { |
|
0 commit comments