< prev index next >

src/java.desktop/share/classes/sun/awt/NullComponentPeer.java

Print this page
rev 57801 : XXXXXXX: Component.xxxImage cleanup
Reviewed-by: XXX
   1 /*
   2  * Copyright (c) 2000, 2016, 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.event.FocusEvent.Cause;
  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     }


 166     }
 167 
 168     public void setBackground(Color c) {
 169     }
 170 
 171     public void setFont(Font f) {
 172     }
 173 
 174     public void updateCursorImmediately() {
 175     }
 176 
 177     public void setCursor(Cursor cursor) {
 178     }
 179 
 180     public boolean requestFocus
 181         (Component lightweightChild, boolean temporary,
 182          boolean focusedWindowChangeAllowed, long time, Cause cause) {
 183         return false;
 184     }
 185 
 186     public Image createImage(ImageProducer producer) {
 187         return null;
 188     }
 189 
 190     public Image createImage(int width, int height) {
 191         return null;
 192     }
 193 
 194     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
 195         return false;
 196     }
 197 
 198     public int  checkImage(Image img, int w, int h, ImageObserver o) {
 199         return 0;
 200     }
 201 
 202     public Dimension preferredSize() {
 203         return getPreferredSize();
 204     }
 205 
 206     public Dimension minimumSize() {
 207         return getMinimumSize();
 208     }
 209 
 210     public Point getLocationOnScreen() {
 211         return new Point(0,0);
 212     }
 213 
 214     public Insets getInsets() {
 215         return insets();
 216     }
 217 
 218     public void beginValidate() {
 219     }
 220 
 221     public void endValidate() {


   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     }


 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() {


< prev index next >