dog.gui
Class DApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--dog.gui.DApplet
All Implemented Interfaces:
javax.accessibility.Accessible, DRootPane, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DApplet
extends java.applet.Applet
implements DRootPane

The base applet class for displaying lightweight components in.

This applet allows you to set a background image and render it in various ways. It performs double-buffering for the contained lightweight components.

See Also:
Serialized Form

Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Image backgroundImage
          The image to use as the background.
protected  DButton cancelButton
          The cancel button in this container.
protected  DButton defaultButton
          The default button in this container.
protected  int mode
          The rendering mode for the background image.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface dog.gui.DRootPane
CENTER, CENTER_TILE, INTEGER_TILE, MAXIMIZE, MAXIMIZE_ASPECT, MAXIMIZE_HORIZONTAL, MAXIMIZE_VERTICAL, TILE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DApplet()
          Constructs an applet with no background image.
DApplet(java.awt.Image backgroundImage)
          Constructs an applet with the specified background image.
DApplet(java.lang.String backgroundImage)
          Constructs an applet with the specified background image.
DApplet(java.net.URL backgroundImage)
          Constructs an applet with the specified background image.
 
Method Summary
 java.awt.Component add(java.awt.Component component)
          Adds the specified component to this pane.
protected  void addImpl(java.awt.Component component, java.lang.Object constraints, int index)
          Overrides addImpl to manage lightweight popups.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a property change listener to receive notification of changes to this component.
 void doLayout()
          Lays out this pane.
 java.awt.Image getBackgroundImage()
          Returns the background image.
 DButton getCancelButton()
          Returns the cancel button in this container.
 DButton getDefaultButton()
          Returns the default button in this container.
 java.awt.Frame getFrame()
          Returns the frame this root pane represents or is part of.
 java.awt.Dimension getMaximumSize()
          Returns the maximum size for this container.
 int getMode()
          Returns the rendering mode for the background image.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size for this container.
 java.lang.String getTitle()
          Returns the title of this pane.
 boolean imageUpdate(java.awt.Image image, int flags, int x, int y, int w, int h)
          The background image has arrived...
 void invalidate()
          Flushes the offscreen buffer as part of invalidation.
 void paint(java.awt.Graphics gPrime)
          Paints the children into an offscreen buffer, then copies the entire image into the graphics context.
protected  void paintImpl(java.awt.Graphics g)
          This method can be overridden to paint onto the applet.
 void processCancelAction(java.awt.event.ActionEvent event)
          Activates the cancel button in the container.
 void processDefaultAction(java.awt.event.ActionEvent event)
          Activates the default button in the container.
protected  void processKeyEvent(java.awt.event.KeyEvent event)
           
 void remove(java.awt.Component component)
          Removes the specified component from this pane.
 void removeAll()
          Removes all components from this pane.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a property change listener so it no longer receives notification of changes to this component.
 void setBackgroundImage(java.awt.Image image)
          Sets the background image.
 void setBackgroundImage(java.lang.String file)
          Sets the background image from a file.
 void setBackgroundImage(java.net.URL url)
          Sets the background image from a URL.
 void setCancelButton(DButton button)
          Sets the cancel button in this container.
 void setDefaultButton(DButton button)
          Sets the default button in this container.
 void setLayout(java.awt.LayoutManager layout)
          Sets the layout manager for this pane.
 void setMode(int mode)
          Sets the rendering mode for the background image.
 void setTitle(java.lang.String title)
          Sets the title of this pane.
 void update(java.awt.Graphics g)
          Update does not erase the background before painting (why bother?).
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, addContainerListener, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMinimumSize, insets, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, 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, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dog.gui.DRootPane
getFont, getFontMetrics, getInsets, getSize, setCursor
 

Field Detail

mode

protected int mode
The rendering mode for the background image.

backgroundImage

protected java.awt.Image backgroundImage
The image to use as the background.

defaultButton

protected DButton defaultButton
The default button in this container.

cancelButton

protected DButton cancelButton
The cancel button in this container.
Constructor Detail

DApplet

public DApplet()
Constructs an applet with no background image.

DApplet

public DApplet(java.awt.Image backgroundImage)
Constructs an applet with the specified background image.

DApplet

public DApplet(java.lang.String backgroundImage)
Constructs an applet with the specified background image.

DApplet

public DApplet(java.net.URL backgroundImage)
Constructs an applet with the specified background image.
Method Detail

getMode

public int getMode()
Returns the rendering mode for the background image.
Specified by:
getMode in interface DRootPane
See Also:
setMode(int)

setMode

public void setMode(int mode)
Sets the rendering mode for the background image.
Specified by:
setMode in interface DRootPane
Parameters:
mode - one of CENTER, TILE, INTEGER_TILE, CENTER_TILE, MAXIMIZE, MAXIMIZE_ASPECT, MAXIMIZE_VERTICAL, or MAXIMIZE_HORIZONTAL
See Also:
getMode()

getBackgroundImage

public java.awt.Image getBackgroundImage()
Returns the background image.
Specified by:
getBackgroundImage in interface DRootPane
See Also:
setBackgroundImage(java.awt.Image)

setBackgroundImage

public void setBackgroundImage(java.awt.Image image)
Sets the background image.
Specified by:
setBackgroundImage in interface DRootPane
Parameters:
image - the background image.
See Also:
getBackgroundImage()

setBackgroundImage

public void setBackgroundImage(java.lang.String file)
Sets the background image from a file.
Specified by:
setBackgroundImage in interface DRootPane
Parameters:
file - the image file.
See Also:
getBackgroundImage()

setBackgroundImage

public void setBackgroundImage(java.net.URL url)
Sets the background image from a URL.
Specified by:
setBackgroundImage in interface DRootPane
Parameters:
url - the image URL.
See Also:
getBackgroundImage()

getDefaultButton

public DButton getDefaultButton()
Returns the default button in this container.
Specified by:
getDefaultButton in interface DRootPane

setDefaultButton

public void setDefaultButton(DButton button)
Sets the default button in this container.
Specified by:
setDefaultButton in interface DRootPane

processDefaultAction

public void processDefaultAction(java.awt.event.ActionEvent event)
Activates the default button in the container.
Specified by:
processDefaultAction in interface DRootPane

getCancelButton

public DButton getCancelButton()
Returns the cancel button in this container.
Specified by:
getCancelButton in interface DRootPane

setCancelButton

public void setCancelButton(DButton button)
Sets the cancel button in this container.
Specified by:
setCancelButton in interface DRootPane

processCancelAction

public void processCancelAction(java.awt.event.ActionEvent event)
Activates the cancel button in the container.
Specified by:
processCancelAction in interface DRootPane

getTitle

public java.lang.String getTitle()
Returns the title of this pane.
Specified by:
getTitle in interface DRootPane

setTitle

public void setTitle(java.lang.String title)
Sets the title of this pane.
Specified by:
setTitle in interface DRootPane

getFrame

public java.awt.Frame getFrame()
Returns the frame this root pane represents or is part of.
Specified by:
getFrame in interface DRootPane

setLayout

public void setLayout(java.awt.LayoutManager layout)
Sets the layout manager for this pane.
Overrides:
setLayout in class java.awt.Container

add

public java.awt.Component add(java.awt.Component component)
Adds the specified component to this pane.
Specified by:
add in interface DRootPane
Overrides:
add in class java.awt.Container
Parameters:
component - the component to be added.
Returns:
the component.

addImpl

protected void addImpl(java.awt.Component component,
                       java.lang.Object constraints,
                       int index)
Overrides addImpl to manage lightweight popups.
Overrides:
addImpl in class java.awt.Container

remove

public void remove(java.awt.Component component)
Removes the specified component from this pane.
Specified by:
remove in interface DRootPane
Overrides:
remove in class java.awt.Container
Parameters:
component - the component to be removed
See Also:
add(java.awt.Component)

removeAll

public void removeAll()
Removes all components from this pane.
Overrides:
removeAll in class java.awt.Container

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size for this container.
Overrides:
getPreferredSize in class java.awt.Container

getMaximumSize

public java.awt.Dimension getMaximumSize()
Returns the maximum size for this container.
Overrides:
getMaximumSize in class java.awt.Container

invalidate

public void invalidate()
Flushes the offscreen buffer as part of invalidation.
Overrides:
invalidate in class java.awt.Container

imageUpdate

public boolean imageUpdate(java.awt.Image image,
                           int flags,
                           int x,
                           int y,
                           int w,
                           int h)
The background image has arrived...
Overrides:
imageUpdate in class java.awt.Component

doLayout

public void doLayout()
Lays out this pane.
Overrides:
doLayout in class java.awt.Container

update

public void update(java.awt.Graphics g)
Update does not erase the background before painting (why bother?).
Overrides:
update in class java.awt.Container

paint

public void paint(java.awt.Graphics gPrime)
Paints the children into an offscreen buffer, then copies the entire image into the graphics context.
Overrides:
paint in class java.awt.Container

paintImpl

protected void paintImpl(java.awt.Graphics g)
This method can be overridden to paint onto the applet. Double-buffering is preserved.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener to receive notification of changes to this component.
Overrides:
addPropertyChangeListener in class java.awt.Component
Parameters:
l - the listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener so it no longer receives notification of changes to this component.
Overrides:
removePropertyChangeListener in class java.awt.Component
Parameters:
l - the listener

processKeyEvent

protected void processKeyEvent(java.awt.event.KeyEvent event)
Overrides:
processKeyEvent in class java.awt.Component