286N/A/*
286N/A * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/Apackage sun.awt;
286N/A
286N/Aimport java.awt.AWTException;
286N/Aimport java.awt.BufferCapabilities;
286N/Aimport java.awt.Color;
286N/Aimport java.awt.Component;
286N/Aimport java.awt.Cursor;
286N/Aimport java.awt.Dimension;
286N/Aimport java.awt.Font;
286N/Aimport java.awt.FontMetrics;
286N/Aimport java.awt.Graphics;
286N/Aimport java.awt.GraphicsConfiguration;
286N/Aimport java.awt.Image;
286N/Aimport java.awt.Insets;
286N/Aimport java.awt.MenuBar;
286N/Aimport java.awt.Point;
286N/Aimport java.awt.Event;
286N/Aimport java.awt.event.PaintEvent;
286N/Aimport java.awt.image.ColorModel;
286N/Aimport java.awt.image.ImageObserver;
286N/Aimport java.awt.image.ImageProducer;
286N/Aimport java.awt.image.VolatileImage;
286N/Aimport java.awt.peer.CanvasPeer;
286N/Aimport java.awt.peer.LightweightPeer;
286N/Aimport java.awt.peer.PanelPeer;
286N/Aimport java.awt.peer.ComponentPeer;
286N/Aimport java.awt.peer.ContainerPeer;
286N/Aimport java.awt.Rectangle;
286N/Aimport sun.java2d.pipe.Region;
286N/A
286N/A
286N/A/**
286N/A * Implements the LightweightPeer interface for use in lightweight components
286N/A * that have no native window associated with them. This gets created by
286N/A * default in Component so that Component and Container can be directly
286N/A * extended to create useful components written entirely in java. These
286N/A * components must be hosted somewhere higher up in the component tree by a
286N/A * native container (such as a Frame).
286N/A *
286N/A * This implementation provides no useful semantics and serves only as a
286N/A * marker. One could provide alternative implementations in java that do
286N/A * something useful for some of the other peer interfaces to minimize the
286N/A * native code.
286N/A *
286N/A * This was renamed from java.awt.LightweightPeer (a horrible and confusing
286N/A * name) and moved from java.awt.Toolkit into sun.awt as a public class in
286N/A * its own file.
286N/A *
286N/A * @author Timothy Prinzing
286N/A * @author Michael Martak
286N/A */
286N/A
286N/Apublic class NullComponentPeer implements LightweightPeer,
286N/A CanvasPeer, PanelPeer {
286N/A
286N/A public boolean isObscured() {
286N/A return false;
286N/A }
286N/A
286N/A public boolean canDetermineObscurity() {
286N/A return false;
286N/A }
286N/A
286N/A public boolean isFocusable() {
286N/A return false;
286N/A }
286N/A
286N/A public void setVisible(boolean b) {
286N/A }
286N/A
286N/A public void show() {
286N/A }
286N/A
286N/A public void hide() {
286N/A }
286N/A
286N/A public void setEnabled(boolean b) {
286N/A }
286N/A
286N/A public void enable() {
286N/A }
286N/A
286N/A public void disable() {
}
public void paint(Graphics g) {
}
public void repaint(long tm, int x, int y, int width, int height) {
}
public void print(Graphics g) {
}
public void setBounds(int x, int y, int width, int height, int op) {
}
public void reshape(int x, int y, int width, int height) {
}
public void coalescePaintEvent(PaintEvent e) {
}
public boolean handleEvent(Event e) {
return false;
}
public void handleEvent(java.awt.AWTEvent arg0) {
}
public Dimension getPreferredSize() {
return new Dimension(1,1);
}
public Dimension getMinimumSize() {
return new Dimension(1,1);
}
public java.awt.Toolkit getToolkit() {
return null;
}
public ColorModel getColorModel() {
return null;
}
public Graphics getGraphics() {
return null;
}
public GraphicsConfiguration getGraphicsConfiguration() {
return null;
}
public FontMetrics getFontMetrics(Font font) {
return null;
}
public void dispose() {
// no native code
}
public void setForeground(Color c) {
}
public void setBackground(Color c) {
}
public void setFont(Font f) {
}
public void updateCursorImmediately() {
}
public void setCursor(Cursor cursor) {
}
public boolean requestFocus
(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) {
return false;
}
public Image createImage(ImageProducer producer) {
return null;
}
public Image createImage(int width, int height) {
return null;
}
public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
return false;
}
public int checkImage(Image img, int w, int h, ImageObserver o) {
return 0;
}
public Dimension preferredSize() {
return getPreferredSize();
}
public Dimension minimumSize() {
return getMinimumSize();
}
public Point getLocationOnScreen() {
return new Point(0,0);
}
public Insets getInsets() {
return insets();
}
public void beginValidate() {
}
public void endValidate() {
}
public Insets insets() {
return new Insets(0, 0, 0, 0);
}
public boolean isPaintPending() {
return false;
}
public boolean handlesWheelScrolling() {
return false;
}
public VolatileImage createVolatileImage(int width, int height) {
return null;
}
public void beginLayout() {
}
public void endLayout() {
}
public void createBuffers(int numBuffers, BufferCapabilities caps)
throws AWTException {
throw new AWTException(
"Page-flipping is not allowed on a lightweight component");
}
public Image getBackBuffer() {
throw new IllegalStateException(
"Page-flipping is not allowed on a lightweight component");
}
public void flip(int x1, int y1, int x2, int y2,
BufferCapabilities.FlipContents flipAction)
{
throw new IllegalStateException(
"Page-flipping is not allowed on a lightweight component");
}
public void destroyBuffers() {
}
/**
* @see java.awt.peer.ComponentPeer#isReparentSupported
*/
public boolean isReparentSupported() {
return false;
}
/**
* @see java.awt.peer.ComponentPeer#reparent
*/
public void reparent(ContainerPeer newNativeParent) {
throw new UnsupportedOperationException();
}
public void layout() {
}
public Rectangle getBounds() {
return new Rectangle(0, 0, 0, 0);
}
/**
* Applies the shape to the native component window.
* @since 1.7
*/
public void applyShape(Region shape) {
}
/**
* Lowers this component at the bottom of the above HW peer. If the above parameter
* is null then the method places this component at the top of the Z-order.
*/
public void setZOrder(ComponentPeer above) {
}
public boolean updateGraphicsData(GraphicsConfiguration gc) {
return false;
}
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
GraphicsConfiguration gc)
{
return gc;
}
}