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