java.awt
Class Component.FlipBufferStrategy

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.image.BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy 
      extended by java.awt.Component.FlipBufferStrategy
Enclosing class:
Component sample code for java.awt.Component definition code for java.awt.Component

protected class Component.FlipBufferStrategy
extends BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy

Inner class for flipping buffers on a component. That component must be a Canvas or Window.

Since:
1.4
See Also:
Canvas sample code for java.awt.Canvas definition code for java.awt.Canvas , Window sample code for java.awt.Window definition code for java.awt.Window , BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy

Field Summary
protected  BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities caps sample code for java.awt.Component.FlipBufferStrategy.caps definition code for java.awt.Component.FlipBufferStrategy.caps
          The buffering capabilities
protected  Image sample code for java.awt.Image definition code for java.awt.Image drawBuffer sample code for java.awt.Component.FlipBufferStrategy.drawBuffer definition code for java.awt.Component.FlipBufferStrategy.drawBuffer
          The drawing buffer
protected  VolatileImage sample code for java.awt.image.VolatileImage definition code for java.awt.image.VolatileImage drawVBuffer sample code for java.awt.Component.FlipBufferStrategy.drawVBuffer definition code for java.awt.Component.FlipBufferStrategy.drawVBuffer
          The drawing buffer as a volatile image
protected  int numBuffers sample code for java.awt.Component.FlipBufferStrategy.numBuffers definition code for java.awt.Component.FlipBufferStrategy.numBuffers
          The number of buffers
protected  boolean validatedContents sample code for java.awt.Component.FlipBufferStrategy.validatedContents definition code for java.awt.Component.FlipBufferStrategy.validatedContents
          Whether or not the drawing buffer has been recently restored from a lost state.
 
Constructor Summary
protected Component.FlipBufferStrategy sample code for java.awt.Component.FlipBufferStrategy.Component.FlipBufferStrategy(int, java.awt.BufferCapabilities) definition code for java.awt.Component.FlipBufferStrategy.Component.FlipBufferStrategy(int, java.awt.BufferCapabilities) (int numBuffers, BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  caps)
          Creates a new flipping buffer strategy for this component.
 
Method Summary
 boolean contentsLost sample code for java.awt.Component.FlipBufferStrategy.contentsLost() definition code for java.awt.Component.FlipBufferStrategy.contentsLost() ()
          Returns whether the drawing buffer was lost since the last call to getDrawGraphics.
 boolean contentsRestored sample code for java.awt.Component.FlipBufferStrategy.contentsRestored() definition code for java.awt.Component.FlipBufferStrategy.contentsRestored() ()
          Returns whether the drawing buffer was recently restored from a lost state and reinitialized to the default background color (white).
protected  void createBuffers sample code for java.awt.Component.FlipBufferStrategy.createBuffers(int, java.awt.BufferCapabilities) definition code for java.awt.Component.FlipBufferStrategy.createBuffers(int, java.awt.BufferCapabilities) (int numBuffers, BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  caps)
          Creates one or more complex, flipping buffers with the given capabilities.
protected  void destroyBuffers sample code for java.awt.Component.FlipBufferStrategy.destroyBuffers() definition code for java.awt.Component.FlipBufferStrategy.destroyBuffers() ()
          Destroys the buffers created through this object
protected  void flip sample code for java.awt.Component.FlipBufferStrategy.flip(java.awt.BufferCapabilities.FlipContents) definition code for java.awt.Component.FlipBufferStrategy.flip(java.awt.BufferCapabilities.FlipContents) (BufferCapabilities.FlipContents sample code for java.awt.BufferCapabilities.FlipContents definition code for java.awt.BufferCapabilities.FlipContents  flipAction)
          Flipping moves the contents of the back buffer to the front buffer, either by copying or by moving the video pointer.
protected  Image sample code for java.awt.Image definition code for java.awt.Image getBackBuffer sample code for java.awt.Component.FlipBufferStrategy.getBackBuffer() definition code for java.awt.Component.FlipBufferStrategy.getBackBuffer() ()
           
 BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities getCapabilities sample code for java.awt.Component.FlipBufferStrategy.getCapabilities() definition code for java.awt.Component.FlipBufferStrategy.getCapabilities() ()
           
 Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics getDrawGraphics sample code for java.awt.Component.FlipBufferStrategy.getDrawGraphics() definition code for java.awt.Component.FlipBufferStrategy.getDrawGraphics() ()
           
protected  void revalidate sample code for java.awt.Component.FlipBufferStrategy.revalidate() definition code for java.awt.Component.FlipBufferStrategy.revalidate() ()
          Restore the drawing buffer if it has been lost
 void show sample code for java.awt.Component.FlipBufferStrategy.show() definition code for java.awt.Component.FlipBufferStrategy.show() ()
          Makes the next available buffer visible by either blitting or flipping.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

numBuffers sample code for java.awt.Component.FlipBufferStrategy.numBuffers

protected int numBuffers
The number of buffers


caps sample code for java.awt.Component.FlipBufferStrategy.caps

protected BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  caps
The buffering capabilities


drawBuffer sample code for java.awt.Component.FlipBufferStrategy.drawBuffer

protected Image sample code for java.awt.Image definition code for java.awt.Image  drawBuffer
The drawing buffer


drawVBuffer sample code for java.awt.Component.FlipBufferStrategy.drawVBuffer

protected VolatileImage sample code for java.awt.image.VolatileImage definition code for java.awt.image.VolatileImage  drawVBuffer
The drawing buffer as a volatile image


validatedContents sample code for java.awt.Component.FlipBufferStrategy.validatedContents

protected boolean validatedContents
Whether or not the drawing buffer has been recently restored from a lost state.

Constructor Detail

Component.FlipBufferStrategy sample code for java.awt.Component.FlipBufferStrategy(int, java.awt.BufferCapabilities) definition code for java.awt.Component.FlipBufferStrategy(int, java.awt.BufferCapabilities)

protected Component.FlipBufferStrategy(int numBuffers,
                                       BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  caps)
                                throws AWTException sample code for java.awt.AWTException definition code for java.awt.AWTException 
Creates a new flipping buffer strategy for this component. The component must be a Canvas or Window.

Parameters:
numBuffers - the number of buffers
caps - the capabilities of the buffers
Throws:
AWTException sample code for java.awt.AWTException definition code for java.awt.AWTException - if the capabilities supplied could not be supported or met
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if the component is not a canvas or window.
See Also:
Canvas sample code for java.awt.Canvas definition code for java.awt.Canvas , Window sample code for java.awt.Window definition code for java.awt.Window
Method Detail

createBuffers sample code for java.awt.Component.FlipBufferStrategy.createBuffers(int, java.awt.BufferCapabilities) definition code for java.awt.Component.FlipBufferStrategy.createBuffers(int, java.awt.BufferCapabilities)

protected void createBuffers(int numBuffers,
                             BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  caps)
                      throws AWTException sample code for java.awt.AWTException definition code for java.awt.AWTException 
Creates one or more complex, flipping buffers with the given capabilities.

Parameters:
numBuffers - number of buffers to create; must be greater than one
caps - the capabilities of the buffers. BufferCapabilities.isPageFlipping must be true.
Throws:
AWTException sample code for java.awt.AWTException definition code for java.awt.AWTException - if the capabilities supplied could not be supported or met
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the component has no peer
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if numBuffers is less than two, or if BufferCapabilities.isPageFlipping is not true.
See Also:
BufferCapabilities.isPageFlipping() sample code for java.awt.BufferCapabilities.isPageFlipping() definition code for java.awt.BufferCapabilities.isPageFlipping()

getBackBuffer sample code for java.awt.Component.FlipBufferStrategy.getBackBuffer() definition code for java.awt.Component.FlipBufferStrategy.getBackBuffer()

protected Image sample code for java.awt.Image definition code for java.awt.Image  getBackBuffer()
Returns:
direct access to the back buffer, as an image.
Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the buffers have not yet been created

flip sample code for java.awt.Component.FlipBufferStrategy.flip(java.awt.BufferCapabilities.FlipContents) definition code for java.awt.Component.FlipBufferStrategy.flip(java.awt.BufferCapabilities.FlipContents)

protected void flip(BufferCapabilities.FlipContents sample code for java.awt.BufferCapabilities.FlipContents definition code for java.awt.BufferCapabilities.FlipContents  flipAction)
Flipping moves the contents of the back buffer to the front buffer, either by copying or by moving the video pointer.

Parameters:
flipAction - an integer value describing the flipping action for the contents of the back buffer. This should be one of the values of the BufferCapabilities.FlipContents property.
Throws:
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if the buffers have not yet been created
See Also:
BufferCapabilities.getFlipContents() sample code for java.awt.BufferCapabilities.getFlipContents() definition code for java.awt.BufferCapabilities.getFlipContents()

destroyBuffers sample code for java.awt.Component.FlipBufferStrategy.destroyBuffers() definition code for java.awt.Component.FlipBufferStrategy.destroyBuffers()

protected void destroyBuffers()
Destroys the buffers created through this object


getCapabilities sample code for java.awt.Component.FlipBufferStrategy.getCapabilities() definition code for java.awt.Component.FlipBufferStrategy.getCapabilities()

public BufferCapabilities sample code for java.awt.BufferCapabilities definition code for java.awt.BufferCapabilities  getCapabilities()
Specified by:
getCapabilities sample code for java.awt.image.BufferStrategy.getCapabilities() definition code for java.awt.image.BufferStrategy.getCapabilities() in class BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy
Returns:
the buffering capabilities of this strategy

getDrawGraphics sample code for java.awt.Component.FlipBufferStrategy.getDrawGraphics() definition code for java.awt.Component.FlipBufferStrategy.getDrawGraphics()

public Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  getDrawGraphics()
Specified by:
getDrawGraphics sample code for java.awt.image.BufferStrategy.getDrawGraphics() definition code for java.awt.image.BufferStrategy.getDrawGraphics() in class BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy
Returns:
the graphics on the drawing buffer. This method may not be synchronized for performance reasons; use of this method by multiple threads should be handled at the application level. Disposal of the graphics object must be handled by the application.

revalidate sample code for java.awt.Component.FlipBufferStrategy.revalidate() definition code for java.awt.Component.FlipBufferStrategy.revalidate()

protected void revalidate()
Restore the drawing buffer if it has been lost


contentsLost sample code for java.awt.Component.FlipBufferStrategy.contentsLost() definition code for java.awt.Component.FlipBufferStrategy.contentsLost()

public boolean contentsLost()
Description copied from class: BufferStrategy sample code for java.awt.image.BufferStrategy.contentsLost() definition code for java.awt.image.BufferStrategy.contentsLost()
Returns whether the drawing buffer was lost since the last call to getDrawGraphics. Since the buffers in a buffer strategy are usually type VolatileImage, they may become lost. For a discussion on lost buffers, see VolatileImage.

Specified by:
contentsLost sample code for java.awt.image.BufferStrategy.contentsLost() definition code for java.awt.image.BufferStrategy.contentsLost() in class BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy
Returns:
whether the drawing buffer was lost since the last call to getDrawGraphics
See Also:
VolatileImage sample code for java.awt.image.VolatileImage definition code for java.awt.image.VolatileImage

contentsRestored sample code for java.awt.Component.FlipBufferStrategy.contentsRestored() definition code for java.awt.Component.FlipBufferStrategy.contentsRestored()

public boolean contentsRestored()
Description copied from class: BufferStrategy sample code for java.awt.image.BufferStrategy.contentsRestored() definition code for java.awt.image.BufferStrategy.contentsRestored()
Returns whether the drawing buffer was recently restored from a lost state and reinitialized to the default background color (white). Since the buffers in a buffer strategy are usually type VolatileImage, they may become lost. If a surface has been recently restored from a lost state since the last call to getDrawGraphics, it may require repainting. For a discussion on lost buffers, see VolatileImage.

Specified by:
contentsRestored sample code for java.awt.image.BufferStrategy.contentsRestored() definition code for java.awt.image.BufferStrategy.contentsRestored() in class BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy
Returns:
whether the drawing buffer was recently restored from a lost state and reinitialized to the default background color (white)
See Also:
VolatileImage sample code for java.awt.image.VolatileImage definition code for java.awt.image.VolatileImage

show sample code for java.awt.Component.FlipBufferStrategy.show() definition code for java.awt.Component.FlipBufferStrategy.show()

public void show()
Makes the next available buffer visible by either blitting or flipping.

Specified by:
show sample code for java.awt.image.BufferStrategy.show() definition code for java.awt.image.BufferStrategy.show() in class BufferStrategy sample code for java.awt.image.BufferStrategy definition code for java.awt.image.BufferStrategy