client
Class DoubleBufferedContainer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--client.DoubleBufferedContainer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DoubleBufferedContainer
extends java.awt.Container

A double buffered container.

Author:
Garrett Wampole
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DoubleBufferedContainer()
          Creates an empty DoubleBufferedContainer.
DoubleBufferedContainer(java.awt.Image wallPaperImage)
          Creates a DoubleBufferedContainer with the specified background image.
 
Method Summary
 void blitBackgroundToScreen(java.awt.Rectangle r)
          Does the same thing as blitBackGroundToWorkplace( Rectangle r ).
 void blitBackgroundToWorkplace()
          Blits the entire backingstore to the front buffer
 void blitBackgroundToWorkplace(java.awt.Rectangle r)
          Blits the specified rectangle to the front buffer.
 void blitWorkplaceToScreen()
          Does the same thing as blitBackgroundtoWorkplace().
 void blitWorkplaceToScreen(java.awt.Rectangle r)
          Does the same thing as blitBackGroundToWorkplace( Rectangle r ).
 void eraseComponent(java.awt.Component comp)
          Deletes the specified component as soon as possible.
 void eraseComponent(java.awt.Component comp, boolean update)
          Deletes the specified component.
 java.awt.Image getBackgroundBuffer()
          Returns an Image representing the back buffer.
 java.awt.Graphics getBackgroundGraphics()
          Returns the graphics context of the back buffer.
 java.awt.Image getWorkplaceBuffer()
          Returns an Image representing the front buffer.
 java.awt.Graphics getWorkplaceGraphics()
          Returns the graphics context of the front buffer.
 void moveComponent(java.awt.Component comp, java.awt.Point location)
          Moves the specified component to the specifies point.
 void moveComponent(java.awt.Component comp, java.awt.Point newLoc, boolean update)
          Moves the specified component to the specified point.
 void paint(java.awt.Graphics g)
          Paints components on the container.
protected  void paintBackground()
          Paints the background Image.
protected  void paintBackground(java.awt.Graphics g)
          Paints the background Image.
protected  void paintBackground(java.awt.Rectangle clip)
          Paints the specified portion of the background Image.
 void paintComponent(java.awt.Component comp)
          Paints the specified component as soon as possible.
 void paintComponent(java.awt.Component comp, boolean update)
          Paints the specified compoents as soon as possible.
 void paintComponents(java.awt.Rectangle clip, boolean update)
          Paints all the compoents in the specified rectangle.
protected  void paintOverlappingComponents(java.awt.Component comp)
          Correctly paints overlapping components.
 void setWallpaperImage(java.awt.Image wallPaperImage)
          Sets the wallpaper image.
 void update(java.awt.Graphics g)
          Calls paint().
protected  boolean windowDamaged(java.awt.Graphics g)
          Returns true or false based on if the front and back buffers to not match.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleBufferedContainer

public DoubleBufferedContainer()
Creates an empty DoubleBufferedContainer.


DoubleBufferedContainer

public DoubleBufferedContainer(java.awt.Image wallPaperImage)
Creates a DoubleBufferedContainer with the specified background image.

Parameters:
wallPaperImage - A background image
Method Detail

setWallpaperImage

public void setWallpaperImage(java.awt.Image wallPaperImage)
Sets the wallpaper image.

Parameters:
wallPaperImage - A background Image

update

public void update(java.awt.Graphics g)
Calls paint().

Overrides:
update in class java.awt.Container
Parameters:
g - A graphics context

paint

public void paint(java.awt.Graphics g)
Paints components on the container.

Overrides:
paint in class java.awt.Container
Parameters:
g - A graphics context

paintComponents

public void paintComponents(java.awt.Rectangle clip,
                            boolean update)
Paints all the compoents in the specified rectangle.

Parameters:
clip - The bounding rectangle
update - Flags whether or not the background gets redrawn

paintComponent

public void paintComponent(java.awt.Component comp)
Paints the specified component as soon as possible.

Parameters:
comp - The component to be painted

eraseComponent

public void eraseComponent(java.awt.Component comp)
Deletes the specified component as soon as possible.

Parameters:
comp - The component to be deleted

moveComponent

public void moveComponent(java.awt.Component comp,
                          java.awt.Point location)
Moves the specified component to the specifies point.

Parameters:
comp - The component to be moved
location - The point where the component is to be moved

paintComponent

public void paintComponent(java.awt.Component comp,
                           boolean update)
Paints the specified compoents as soon as possible.

Parameters:
comp - The component to be painted
update - Flags whether or not the background gets redrawn

eraseComponent

public void eraseComponent(java.awt.Component comp,
                           boolean update)
Deletes the specified component.

Parameters:
comp - The component to be deleted
update - Flags whether or not the background gets redrawn

moveComponent

public void moveComponent(java.awt.Component comp,
                          java.awt.Point newLoc,
                          boolean update)
Moves the specified component to the specified point.

Parameters:
comp - The component to be moved
newLoc - The point where the component is to be moved
update - Flags whether or not the background gets redrawn

getWorkplaceGraphics

public java.awt.Graphics getWorkplaceGraphics()
Returns the graphics context of the front buffer.

Returns:
A graphics context

getBackgroundGraphics

public java.awt.Graphics getBackgroundGraphics()
Returns the graphics context of the back buffer.

Returns:
A graphics context

blitBackgroundToWorkplace

public void blitBackgroundToWorkplace()
Blits the entire backingstore to the front buffer


blitWorkplaceToScreen

public void blitWorkplaceToScreen()
Does the same thing as blitBackgroundtoWorkplace().


blitBackgroundToWorkplace

public void blitBackgroundToWorkplace(java.awt.Rectangle r)
Blits the specified rectangle to the front buffer.

Parameters:
r - The bounding rectangle

blitWorkplaceToScreen

public void blitWorkplaceToScreen(java.awt.Rectangle r)
Does the same thing as blitBackGroundToWorkplace( Rectangle r ).


blitBackgroundToScreen

public void blitBackgroundToScreen(java.awt.Rectangle r)
Does the same thing as blitBackGroundToWorkplace( Rectangle r ).


getWorkplaceBuffer

public java.awt.Image getWorkplaceBuffer()
Returns an Image representing the front buffer.

Returns:
An Image

getBackgroundBuffer

public java.awt.Image getBackgroundBuffer()
Returns an Image representing the back buffer.

Returns:
An Image

windowDamaged

protected boolean windowDamaged(java.awt.Graphics g)
Returns true or false based on if the front and back buffers to not match.

Parameters:
g - A graphics context
Returns:
True or false

paintOverlappingComponents

protected void paintOverlappingComponents(java.awt.Component comp)
Correctly paints overlapping components.

Parameters:
comp - A overlapped component

paintBackground

protected void paintBackground()
Paints the background Image.


paintBackground

protected void paintBackground(java.awt.Rectangle clip)
Paints the specified portion of the background Image.

Parameters:
clip - The bounding rectangle

paintBackground

protected void paintBackground(java.awt.Graphics g)
Paints the background Image.

Parameters:
g - A graphics context