jdk/src/java.desktop/share/classes/java/awt/Component.java
changeset 31897 7be531b4df44
parent 30947 8dae2913daf4
child 32865 f9cb6e427f9e
equal deleted inserted replaced
31896:89a49ef6dda6 31897:7be531b4df44
  3978         return null;
  3978         return null;
  3979     }
  3979     }
  3980 
  3980 
  3981     /**
  3981     /**
  3982      * Inner class for flipping buffers on a component.  That component must
  3982      * Inner class for flipping buffers on a component.  That component must
  3983      * be a <code>Canvas</code> or <code>Window</code>.
  3983      * be a <code>Canvas</code> or <code>Window</code> or <code>Applet</code>.
  3984      * @see Canvas
  3984      * @see Canvas
  3985      * @see Window
  3985      * @see Window
       
  3986      * @see Applet
  3986      * @see java.awt.image.BufferStrategy
  3987      * @see java.awt.image.BufferStrategy
  3987      * @author Michael Martak
  3988      * @author Michael Martak
  3988      * @since 1.4
  3989      * @since 1.4
  3989      */
  3990      */
  3990     protected class FlipBufferStrategy extends BufferStrategy {
  3991     protected class FlipBufferStrategy extends BufferStrategy {
  4028          */
  4029          */
  4029         int height;
  4030         int height;
  4030 
  4031 
  4031         /**
  4032         /**
  4032          * Creates a new flipping buffer strategy for this component.
  4033          * Creates a new flipping buffer strategy for this component.
  4033          * The component must be a <code>Canvas</code> or <code>Window</code>.
  4034          * The component must be a <code>Canvas</code> or <code>Window</code> or
       
  4035          * <code>Applet</code>.
  4034          * @see Canvas
  4036          * @see Canvas
  4035          * @see Window
  4037          * @see Window
       
  4038          * @see Applet
  4036          * @param numBuffers the number of buffers
  4039          * @param numBuffers the number of buffers
  4037          * @param caps the capabilities of the buffers
  4040          * @param caps the capabilities of the buffers
  4038          * @exception AWTException if the capabilities supplied could not be
  4041          * @exception AWTException if the capabilities supplied could not be
  4039          * supported or met
  4042          * supported or met
  4040          * @exception ClassCastException if the component is not a canvas or
  4043          * @exception ClassCastException if the component is not a canvas or
  4047          */
  4050          */
  4048         protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
  4051         protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
  4049             throws AWTException
  4052             throws AWTException
  4050         {
  4053         {
  4051             if (!(Component.this instanceof Window) &&
  4054             if (!(Component.this instanceof Window) &&
  4052                 !(Component.this instanceof Canvas))
  4055                 !(Component.this instanceof Canvas) &&
       
  4056                 !(Component.this instanceof Applet))
  4053             {
  4057             {
  4054                 throw new ClassCastException(
  4058                 throw new ClassCastException(
  4055                     "Component must be a Canvas or Window");
  4059                         "Component must be a Canvas or Window or Applet");
  4056             }
  4060             }
  4057             this.numBuffers = numBuffers;
  4061             this.numBuffers = numBuffers;
  4058             this.caps = caps;
  4062             this.caps = caps;
  4059             createBuffers(numBuffers, caps);
  4063             createBuffers(numBuffers, caps);
  4060         }
  4064         }