protected class java.awt
Component.FlipBufferStrategy


Show All Login
Java SE 6
  
Extends: BufferStrategy
Contained within: Component
Details
Inner class for flipping buffers on a component. That component must be a Canvas or Window.
since1.4
See also java.awt.Canvas, java.awt.Window, java.awt.image.BufferStrategy

Fields
protected int numBuffers
The number of buffers
protected BufferCapabilities caps
The buffering capabilities
protected Image drawBuffer
The drawing buffer
protected VolatileImage drawVBuffer
The drawing buffer as a volatile image
protected boolean validatedContents
Whether or not the drawing buffer has been recently restored from a lost state.

Constructors
protected Component.FlipBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException Details
Creates a new flipping buffer strategy for this component. The component must be a Canvas or Window.
numBuffersthe number of buffers
capsthe capabilities of the buffers
ThrowsAWTException: if the capabilities supplied could not be supported or met
ThrowsClassCastException: if the component is not a canvas or window.
See also java.awt.Canvas, java.awt.Window

Methods
public boolean contentsLost() Details
returnwhether the drawing buffer was lost since the last call to getDrawGraphics
public boolean contentsRestored() Details
returnwhether the drawing buffer was recently restored from a lost state and reinitialized to the default background color (white)
protected void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException Details
Creates one or more complex, flipping buffers with the given capabilities.
numBuffersnumber of buffers to create; must be greater than one
capsthe capabilities of the buffers. BufferCapabilities.isPageFlipping must be true.
ThrowsAWTException: if the capabilities supplied could not be supported or met
ThrowsIllegalStateException: if the component has no peer
ThrowsIllegalArgumentException: if numBuffers is less than two, or if BufferCapabilities.isPageFlipping is not true.
See also isPageFlipping()
protected void destroyBuffers()
Destroys the buffers created through this object
public void dispose() Details
Releases system resources currently consumed by this BufferStrategy and removes it from the associated Component. After invoking this method, getBufferStrategy will return null. Trying to use a BufferStrategy after it has been disposed will result in undefined behavior.
since1.6
protected void flip(BufferCapabilities.FlipContents flipAction) Details
Flipping moves the contents of the back buffer to the front buffer, either by copying or by moving the video pointer.
flipActionan 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.
ThrowsIllegalStateException: if the buffers have not yet been created
See also getFlipContents()
protected void revalidate()
Restore the drawing buffer if it has been lost
public void show()
Makes the next available buffer visible by either blitting or flipping.

Properties
protected Image getBackBuffer() Details
returndirect access to the back buffer, as an image.
ThrowsIllegalStateException: if the buffers have not yet been created
public BufferCapabilities getCapabilities() Details
returnthe buffering capabilities of this strategy
public Graphics getDrawGraphics() Details
returnthe 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.