Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/sun/awt/NullComponentPeer.java
41152 views
1
/*
2
* Copyright (c) 2000, 2020, 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.awt;
27
28
import java.awt.AWTException;
29
import java.awt.BufferCapabilities;
30
import java.awt.Color;
31
import java.awt.Component;
32
import java.awt.Cursor;
33
import java.awt.Dimension;
34
import java.awt.Event;
35
import java.awt.Font;
36
import java.awt.FontMetrics;
37
import java.awt.Graphics;
38
import java.awt.GraphicsConfiguration;
39
import java.awt.Image;
40
import java.awt.Insets;
41
import java.awt.Point;
42
import java.awt.Rectangle;
43
import java.awt.event.FocusEvent.Cause;
44
import java.awt.event.PaintEvent;
45
import java.awt.image.ColorModel;
46
import java.awt.image.VolatileImage;
47
import java.awt.peer.CanvasPeer;
48
import java.awt.peer.ComponentPeer;
49
import java.awt.peer.ContainerPeer;
50
import java.awt.peer.LightweightPeer;
51
import java.awt.peer.PanelPeer;
52
53
import sun.java2d.pipe.Region;
54
55
/**
56
* Implements the LightweightPeer interface for use in lightweight components
57
* that have no native window associated with them. This gets created by
58
* default in Component so that Component and Container can be directly
59
* extended to create useful components written entirely in java. These
60
* components must be hosted somewhere higher up in the component tree by a
61
* native container (such as a Frame).
62
*
63
* This implementation provides no useful semantics and serves only as a
64
* marker. One could provide alternative implementations in java that do
65
* something useful for some of the other peer interfaces to minimize the
66
* native code.
67
*
68
* This was renamed from java.awt.LightweightPeer (a horrible and confusing
69
* name) and moved from java.awt.Toolkit into sun.awt as a public class in
70
* its own file.
71
*
72
* @author Timothy Prinzing
73
* @author Michael Martak
74
*/
75
public class NullComponentPeer implements LightweightPeer,
76
CanvasPeer, PanelPeer {
77
78
public boolean isObscured() {
79
return false;
80
}
81
82
public boolean canDetermineObscurity() {
83
return false;
84
}
85
86
public boolean isFocusable() {
87
return false;
88
}
89
90
public void setVisible(boolean b) {
91
}
92
93
public void show() {
94
}
95
96
public void hide() {
97
}
98
99
public void setEnabled(boolean b) {
100
}
101
102
public void enable() {
103
}
104
105
public void disable() {
106
}
107
108
public void paint(Graphics g) {
109
}
110
111
public void repaint(long tm, int x, int y, int width, int height) {
112
}
113
114
public void print(Graphics g) {
115
}
116
117
public void setBounds(int x, int y, int width, int height, int op) {
118
}
119
120
public void reshape(int x, int y, int width, int height) {
121
}
122
123
public void coalescePaintEvent(PaintEvent e) {
124
}
125
126
@SuppressWarnings("deprecation")
127
public boolean handleEvent(Event e) {
128
return false;
129
}
130
131
public void handleEvent(java.awt.AWTEvent arg0) {
132
}
133
134
public Dimension getPreferredSize() {
135
return new Dimension(1,1);
136
}
137
138
public Dimension getMinimumSize() {
139
return new Dimension(1,1);
140
}
141
142
public ColorModel getColorModel() {
143
return null;
144
}
145
146
public Graphics getGraphics() {
147
return null;
148
}
149
150
public GraphicsConfiguration getGraphicsConfiguration() {
151
return null;
152
}
153
154
public FontMetrics getFontMetrics(Font font) {
155
return null;
156
}
157
158
public void dispose() {
159
// no native code
160
}
161
162
public void setForeground(Color c) {
163
}
164
165
public void setBackground(Color c) {
166
}
167
168
public void setFont(Font f) {
169
}
170
171
public void updateCursorImmediately() {
172
}
173
174
public void setCursor(Cursor cursor) {
175
}
176
177
public boolean requestFocus
178
(Component lightweightChild, boolean temporary,
179
boolean focusedWindowChangeAllowed, long time, Cause cause) {
180
return false;
181
}
182
183
public Image createImage(int width, int height) {
184
return null;
185
}
186
187
public Dimension preferredSize() {
188
return getPreferredSize();
189
}
190
191
public Dimension minimumSize() {
192
return getMinimumSize();
193
}
194
195
public Point getLocationOnScreen() {
196
return new Point(0,0);
197
}
198
199
public Insets getInsets() {
200
return insets();
201
}
202
203
public void beginValidate() {
204
}
205
206
public void endValidate() {
207
}
208
209
public Insets insets() {
210
return new Insets(0, 0, 0, 0);
211
}
212
213
public boolean isPaintPending() {
214
return false;
215
}
216
217
public boolean handlesWheelScrolling() {
218
return false;
219
}
220
221
public VolatileImage createVolatileImage(int width, int height) {
222
return null;
223
}
224
225
public void beginLayout() {
226
}
227
228
public void endLayout() {
229
}
230
231
public void createBuffers(int numBuffers, BufferCapabilities caps)
232
throws AWTException {
233
throw new AWTException(
234
"Page-flipping is not allowed on a lightweight component");
235
}
236
public Image getBackBuffer() {
237
throw new IllegalStateException(
238
"Page-flipping is not allowed on a lightweight component");
239
}
240
public void flip(int x1, int y1, int x2, int y2,
241
BufferCapabilities.FlipContents flipAction)
242
{
243
throw new IllegalStateException(
244
"Page-flipping is not allowed on a lightweight component");
245
}
246
public void destroyBuffers() {
247
}
248
249
/**
250
* @see java.awt.peer.ComponentPeer#isReparentSupported
251
*/
252
public boolean isReparentSupported() {
253
return false;
254
}
255
256
/**
257
* @see java.awt.peer.ComponentPeer#reparent
258
*/
259
public void reparent(ContainerPeer newNativeParent) {
260
throw new UnsupportedOperationException();
261
}
262
263
public void layout() {
264
}
265
266
public Rectangle getBounds() {
267
return new Rectangle(0, 0, 0, 0);
268
}
269
270
271
/**
272
* Applies the shape to the native component window.
273
* @since 1.7
274
*/
275
public void applyShape(Region shape) {
276
}
277
278
/**
279
* Lowers this component at the bottom of the above HW peer. If the above parameter
280
* is null then the method places this component at the top of the Z-order.
281
*/
282
public void setZOrder(ComponentPeer above) {
283
}
284
285
public boolean updateGraphicsData(GraphicsConfiguration gc) {
286
return false;
287
}
288
289
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
290
GraphicsConfiguration gc)
291
{
292
return gc;
293
}
294
}
295
296