Class Maze2D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--Maze2D

public class Maze2D
extends Component
implements MazeListener

Draw a 2D maze in an AWT Component. There is no user input.

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Maze2D(MazeModel model)
          Create a 2D maze display with a cell size of 20 pixels.
Maze2D(MazeModel model, int cellSize)
          Create a 2D maze display.
Maze2D(MazeModel model, int cellSize, int dispWidth, int dispHeight)
          Create a 2D maze display.
 
Method Summary
 Dimension getPreferredSize()
          From Component.getPreferredSize.
 int getZ()
          Get the Z co-ordinate of the maze being displayed.
 void mazeChanged(EventObject e)
          From interface MazeListener.
 void paint(Graphics g)
          Paint the maze.
 void setZ(int z)
          Set the Z co-ordinate of the maze being displayed.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Maze2D

public Maze2D(MazeModel model)
Create a 2D maze display with a cell size of 20 pixels.
Parameters:
model - The MazeModel used as the source of the maze.

Maze2D

public Maze2D(MazeModel model,
              int cellSize)
Create a 2D maze display.
Parameters:
model - The MazeModel used as the source of the maze.
cellSize - The cell size in pixels.

Maze2D

public Maze2D(MazeModel model,
              int cellSize,
              int dispWidth,
              int dispHeight)
Create a 2D maze display.
Parameters:
model - The MazeModel used as the source of the maze.
cellSize - The cell size in pixels.
dispWidth - The number of horizontal cells to display at a time.
dispHeight - The number of vertical cells to display at a time.
Method Detail

getPreferredSize

public Dimension getPreferredSize()
From Component.getPreferredSize.
Overrides:
getPreferredSize in class Component

mazeChanged

public void mazeChanged(EventObject e)
From interface MazeListener. The maze has changed, just repaint.
Specified by:
mazeChanged in interface MazeListener

setZ

public void setZ(int z)
Set the Z co-ordinate of the maze being displayed. Repaints the display.

getZ

public int getZ()
Get the Z co-ordinate of the maze being displayed.

paint

public void paint(Graphics g)
Paint the maze. From Component.
Overrides:
paint in class Component