Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.java
41153 views
1
/*
2
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import java.awt.Container;
25
import java.awt.Dimension;
26
import java.awt.GridBagConstraints;
27
import java.awt.GridBagLayout;
28
29
import javax.swing.JApplet;
30
import javax.swing.JFrame;
31
import javax.swing.JLabel;
32
import javax.swing.JScrollBar;
33
import javax.swing.SwingUtilities;
34
import javax.swing.UIManager;
35
36
/*
37
* @test
38
* @bug 8039464
39
* @summary Tests enabling/disabling of titled border's caption
40
* @author Sergey Malenkov
41
* @run applet/manual=yesno Test8039464.html
42
*/
43
44
public class Test8039464 extends JApplet {
45
static {
46
try {
47
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
48
} catch (Exception exception) {
49
throw new Error("unexpected", exception);
50
}
51
}
52
53
@Override
54
public void init() {
55
init(this);
56
}
57
58
private static void init(Container container) {
59
container.setLayout(new GridBagLayout());
60
GridBagConstraints gbc = new GridBagConstraints();
61
gbc.fill = GridBagConstraints.BOTH;
62
gbc.gridx = 0;
63
gbc.gridy = 1;
64
JLabel label = new JLabel();
65
Dimension size = new Dimension(111, 0);
66
label.setPreferredSize(size);
67
label.setMinimumSize(size);
68
container.add(label, gbc);
69
gbc.gridx = 1;
70
gbc.weightx = 1;
71
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
72
gbc.gridx = 2;
73
gbc.gridy = 0;
74
gbc.weightx = 0;
75
gbc.weighty = 1;
76
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
77
}
78
79
public static void main(String[] args) throws Exception {
80
SwingUtilities.invokeLater(new Runnable() {
81
@Override
82
public void run() {
83
JFrame frame = new JFrame("8039464");
84
init(frame);
85
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
86
frame.pack();
87
frame.setLocationRelativeTo(null);
88
frame.setVisible(true);
89
}
90
});
91
}
92
}
93
94