client
Class BackingStore

java.lang.Object
  |
  +--java.awt.event.ComponentAdapter
        |
        +--client.BackingStore
All Implemented Interfaces:
java.awt.event.ComponentListener, java.util.EventListener

public class BackingStore
extends java.awt.event.ComponentAdapter

Defines the offscreen buffer used in client.DoubleBufferedContainer.

Author:
Garrett Wampole

Constructor Summary
BackingStore(java.awt.Component component)
          Constructor
 
Method Summary
 void blitTo(java.awt.Graphics graphics)
          Blits the offscreen buffer to the front buffer.
 void blitTo(java.awt.Graphics g, java.awt.Rectangle clip)
          Blits a portion of the offscreen buffer to the front buffer.
 void blitTo(java.awt.Image im)
          Blits the offscreen buffer to the front buffer.
 void blitTo(java.awt.Image im, java.awt.Rectangle clip)
          Blits a portion of the offscreen buffer to the front buffer.
 void componentResized(java.awt.event.ComponentEvent event)
          Recreates the backingstore if any component on it was resized.
 java.awt.Component getComponent()
          Returns the component on the backingstore.
 java.awt.Graphics getGraphics()
          Returns the offscreen buffers' graphics context.
 java.awt.Image getImage()
          Returns an image of the offscreen buffer.
 void setComponent(java.awt.Component c)
          Sets the component to be drawn on the backingstore.
 
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentMoved, componentShown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackingStore

public BackingStore(java.awt.Component component)
Constructor

Parameters:
component - A component to be drawn on the backingstore
Method Detail

setComponent

public void setComponent(java.awt.Component c)
Sets the component to be drawn on the backingstore.

Parameters:
c - A component to be drawn on the backingstore

getComponent

public java.awt.Component getComponent()
Returns the component on the backingstore.

Returns:
The component on the backingstore

getImage

public java.awt.Image getImage()
Returns an image of the offscreen buffer.

Returns:
An Image representing the offscreen buffer

getGraphics

public java.awt.Graphics getGraphics()
Returns the offscreen buffers' graphics context.

Returns:
A graphics context

componentResized

public void componentResized(java.awt.event.ComponentEvent event)
Recreates the backingstore if any component on it was resized.

Specified by:
componentResized in interface java.awt.event.ComponentListener
Overrides:
componentResized in class java.awt.event.ComponentAdapter
Parameters:
event - The ComponentEvent to be examined

blitTo

public void blitTo(java.awt.Image im)
Blits the offscreen buffer to the front buffer.

Parameters:
im - The image representing the offscreen buffer

blitTo

public void blitTo(java.awt.Graphics graphics)
Blits the offscreen buffer to the front buffer.

Parameters:
graphics - The graphics context of the offscreen buffer

blitTo

public void blitTo(java.awt.Image im,
                   java.awt.Rectangle clip)
Blits a portion of the offscreen buffer to the front buffer.

Parameters:
im - The image representing the offscreen buffer
clip - A rectangle defining the part of the backingstore to be blitted.

blitTo

public void blitTo(java.awt.Graphics g,
                   java.awt.Rectangle clip)
Blits a portion of the offscreen buffer to the front buffer.

Parameters:
clip - A rectangle defining the part of the backingstore to be blitted.