Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java
38841 views
1
/*
2
* Copyright (c) 2007, 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 javax.swing.*;
25
import java.awt.*;
26
import java.util.Locale;
27
28
/*
29
* @test
30
* @summary Check that JTabbedPane constructor and methods do not throw unexpected
31
* exceptions in headless mode
32
* @run main/othervm -Djava.awt.headless=true HeadlessJTabbedPane
33
*/
34
35
public class HeadlessJTabbedPane {
36
public static void main(String args[]) {
37
JTabbedPane s = new JTabbedPane();
38
s.getAccessibleContext();
39
s.isFocusTraversable();
40
s.setEnabled(false);
41
s.setEnabled(true);
42
s.requestFocus();
43
s.requestFocusInWindow();
44
s.getPreferredSize();
45
s.getMaximumSize();
46
s.getMinimumSize();
47
s.contains(1, 2);
48
Component c1 = s.add(new Component(){});
49
Component c2 = s.add(new Component(){});
50
Component c3 = s.add(new Component(){});
51
Insets ins = s.getInsets();
52
s.getAlignmentY();
53
s.getAlignmentX();
54
s.getGraphics();
55
s.setVisible(false);
56
s.setVisible(true);
57
s.setForeground(Color.red);
58
s.setBackground(Color.red);
59
for (String font : Toolkit.getDefaultToolkit().getFontList()) {
60
for (int j = 8; j < 17; j++) {
61
Font f1 = new Font(font, Font.PLAIN, j);
62
Font f2 = new Font(font, Font.BOLD, j);
63
Font f3 = new Font(font, Font.ITALIC, j);
64
Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
65
66
s.setFont(f1);
67
s.setFont(f2);
68
s.setFont(f3);
69
s.setFont(f4);
70
71
s.getFontMetrics(f1);
72
s.getFontMetrics(f2);
73
s.getFontMetrics(f3);
74
s.getFontMetrics(f4);
75
}
76
}
77
s.enable();
78
s.disable();
79
s.reshape(10, 10, 10, 10);
80
s.getBounds(new Rectangle(1, 1, 1, 1));
81
s.getSize(new Dimension(1, 2));
82
s.getLocation(new Point(1, 2));
83
s.getX();
84
s.getY();
85
s.getWidth();
86
s.getHeight();
87
s.isOpaque();
88
s.isValidateRoot();
89
s.isOptimizedDrawingEnabled();
90
s.isDoubleBuffered();
91
s.getComponentCount();
92
s.countComponents();
93
s.getComponent(1);
94
s.getComponent(2);
95
Component[] cs = s.getComponents();
96
s.getLayout();
97
s.setLayout(new FlowLayout());
98
s.doLayout();
99
s.layout();
100
s.invalidate();
101
s.validate();
102
s.remove(0);
103
s.remove(c2);
104
s.removeAll();
105
s.preferredSize();
106
s.minimumSize();
107
s.getComponentAt(1, 2);
108
s.locate(1, 2);
109
s.getComponentAt(new Point(1, 2));
110
s.isFocusCycleRoot(new Container());
111
s.transferFocusBackward();
112
s.setName("goober");
113
s.getName();
114
s.getParent();
115
s.getPeer();
116
s.getGraphicsConfiguration();
117
s.getTreeLock();
118
s.getToolkit();
119
s.isValid();
120
s.isDisplayable();
121
s.isVisible();
122
s.isShowing();
123
s.isEnabled();
124
s.enable(false);
125
s.enable(true);
126
s.enableInputMethods(false);
127
s.enableInputMethods(true);
128
s.show();
129
s.show(false);
130
s.show(true);
131
s.hide();
132
s.getForeground();
133
s.isForegroundSet();
134
s.getBackground();
135
s.isBackgroundSet();
136
s.getFont();
137
s.isFontSet();
138
Container c = new Container();
139
c.add(s);
140
s.getLocale();
141
for (Locale locale : Locale.getAvailableLocales())
142
s.setLocale(locale);
143
144
s.getColorModel();
145
s.getLocation();
146
147
boolean exceptions = false;
148
try {
149
s.getLocationOnScreen();
150
} catch (IllegalComponentStateException e) {
151
exceptions = true;
152
}
153
if (!exceptions)
154
throw new RuntimeException("IllegalComponentStateException did not occur when expected");
155
156
s.location();
157
s.setLocation(1, 2);
158
s.move(1, 2);
159
s.setLocation(new Point(1, 2));
160
s.getSize();
161
s.size();
162
s.setSize(1, 32);
163
s.resize(1, 32);
164
s.setSize(new Dimension(1, 32));
165
s.resize(new Dimension(1, 32));
166
s.getBounds();
167
s.bounds();
168
s.setBounds(10, 10, 10, 10);
169
s.setBounds(new Rectangle(10, 10, 10, 10));
170
s.isLightweight();
171
s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
172
s.getCursor();
173
s.isCursorSet();
174
s.inside(1, 2);
175
s.contains(new Point(1, 2));
176
s.isFocusable();
177
s.setFocusable(true);
178
s.setFocusable(false);
179
s.transferFocus();
180
s.getFocusCycleRootAncestor();
181
s.nextFocus();
182
s.transferFocusUpCycle();
183
s.hasFocus();
184
s.isFocusOwner();
185
s.toString();
186
s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
187
s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
188
s.setComponentOrientation(ComponentOrientation.UNKNOWN);
189
s.getComponentOrientation();
190
}
191
}
192
193