Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/awt/NullComponentPeer.java
38827 views
1
/*
2
* Copyright (c) 2000, 2013, 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.Font;
35
import java.awt.FontMetrics;
36
import java.awt.Graphics;
37
import java.awt.GraphicsConfiguration;
38
import java.awt.Image;
39
import java.awt.Insets;
40
import java.awt.MenuBar;
41
import java.awt.Point;
42
import java.awt.Event;
43
import java.awt.event.PaintEvent;
44
import java.awt.image.ColorModel;
45
import java.awt.image.ImageObserver;
46
import java.awt.image.ImageProducer;
47
import java.awt.image.VolatileImage;
48
import java.awt.peer.CanvasPeer;
49
import java.awt.peer.LightweightPeer;
50
import java.awt.peer.PanelPeer;
51
import java.awt.peer.ComponentPeer;
52
import java.awt.peer.ContainerPeer;
53
import java.awt.Rectangle;
54
import sun.java2d.pipe.Region;
55
56
57
/**
58
* Implements the LightweightPeer interface for use in lightweight components
59
* that have no native window associated with them. This gets created by
60
* default in Component so that Component and Container can be directly
61
* extended to create useful components written entirely in java. These
62
* components must be hosted somewhere higher up in the component tree by a
63
* native container (such as a Frame).
64
*
65
* This implementation provides no useful semantics and serves only as a
66
* marker. One could provide alternative implementations in java that do
67
* something useful for some of the other peer interfaces to minimize the
68
* native code.
69
*
70
* This was renamed from java.awt.LightweightPeer (a horrible and confusing
71
* name) and moved from java.awt.Toolkit into sun.awt as a public class in
72
* its own file.
73
*
74
* @author Timothy Prinzing
75
* @author Michael Martak
76
*/
77
78
public class NullComponentPeer implements LightweightPeer,
79
CanvasPeer, PanelPeer {
80
81
public boolean isObscured() {
82
return false;
83
}
84
85
public boolean canDetermineObscurity() {
86
return false;
87
}
88
89
public boolean isFocusable() {
90
return false;
91
}
92
93
public void setVisible(boolean b) {
94
}
95
96
public void show() {
97
}
98
99
public void hide() {
100
}
101
102
public void setEnabled(boolean b) {
103
}
104
105
public void enable() {
106
}
107
108
public void disable() {
109
}
110
111
public void paint(Graphics g) {
112
}
113
114
public void repaint(long tm, int x, int y, int width, int height) {
115
}
116
117
public void print(Graphics g) {
118
}
119
120
public void setBounds(int x, int y, int width, int height, int op) {
121
}
122
123
public void reshape(int x, int y, int width, int height) {
124
}
125
126
public void coalescePaintEvent(PaintEvent e) {
127
}
128
129
public boolean handleEvent(Event e) {
130
return false;
131
}
132
133
public void handleEvent(java.awt.AWTEvent arg0) {
134
}
135
136
public Dimension getPreferredSize() {
137
return new Dimension(1,1);
138
}
139
140
public Dimension getMinimumSize() {
141
return new Dimension(1,1);
142
}
143
144
public ColorModel getColorModel() {
145
return null;
146
}
147
148
public Graphics getGraphics() {
149
return null;
150
}
151
152
public GraphicsConfiguration getGraphicsConfiguration() {
153
return null;
154
}
155
156
public FontMetrics getFontMetrics(Font font) {
157
return null;
158
}
159
160
public void dispose() {
161
// no native code
162
}
163
164
public void setForeground(Color c) {
165
}
166
167
public void setBackground(Color c) {
168
}
169
170
public void setFont(Font f) {
171
}
172
173
public void updateCursorImmediately() {
174
}
175
176
public void setCursor(Cursor cursor) {
177
}
178
179
public boolean requestFocus
180
(Component lightweightChild, boolean temporary,
181
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) {
182
return false;
183
}
184
185
public Image createImage(ImageProducer producer) {
186
return null;
187
}
188
189
public Image createImage(int width, int height) {
190
return null;
191
}
192
193
public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
194
return false;
195
}
196
197
public int checkImage(Image img, int w, int h, ImageObserver o) {
198
return 0;
199
}
200
201
public Dimension preferredSize() {
202
return getPreferredSize();
203
}
204
205
public Dimension minimumSize() {
206
return getMinimumSize();
207
}
208
209
public Point getLocationOnScreen() {
210
return new Point(0,0);
211
}
212
213
public Insets getInsets() {
214
return insets();
215
}
216
217
public void beginValidate() {
218
}
219
220
public void endValidate() {
221
}
222
223
public Insets insets() {
224
return new Insets(0, 0, 0, 0);
225
}
226
227
public boolean isPaintPending() {
228
return false;
229
}
230
231
public boolean handlesWheelScrolling() {
232
return false;
233
}
234
235
public VolatileImage createVolatileImage(int width, int height) {
236
return null;
237
}
238
239
public void beginLayout() {
240
}
241
242
public void endLayout() {
243
}
244
245
public void createBuffers(int numBuffers, BufferCapabilities caps)
246
throws AWTException {
247
throw new AWTException(
248
"Page-flipping is not allowed on a lightweight component");
249
}
250
public Image getBackBuffer() {
251
throw new IllegalStateException(
252
"Page-flipping is not allowed on a lightweight component");
253
}
254
public void flip(int x1, int y1, int x2, int y2,
255
BufferCapabilities.FlipContents flipAction)
256
{
257
throw new IllegalStateException(
258
"Page-flipping is not allowed on a lightweight component");
259
}
260
public void destroyBuffers() {
261
}
262
263
/**
264
* @see java.awt.peer.ComponentPeer#isReparentSupported
265
*/
266
public boolean isReparentSupported() {
267
return false;
268
}
269
270
/**
271
* @see java.awt.peer.ComponentPeer#reparent
272
*/
273
public void reparent(ContainerPeer newNativeParent) {
274
throw new UnsupportedOperationException();
275
}
276
277
public void layout() {
278
}
279
280
public Rectangle getBounds() {
281
return new Rectangle(0, 0, 0, 0);
282
}
283
284
285
/**
286
* Applies the shape to the native component window.
287
* @since 1.7
288
*/
289
public void applyShape(Region shape) {
290
}
291
292
/**
293
* Lowers this component at the bottom of the above HW peer. If the above parameter
294
* is null then the method places this component at the top of the Z-order.
295
*/
296
public void setZOrder(ComponentPeer above) {
297
}
298
299
public boolean updateGraphicsData(GraphicsConfiguration gc) {
300
return false;
301
}
302
303
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
304
GraphicsConfiguration gc)
305
{
306
return gc;
307
}
308
}
309
310