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