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