Class WalkwayCanvas

Class WalkwayCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----WalkwayCanvas

class WalkwayCanvas
extends Canvas

Variable Index

 o CREATE
 o EDIT
 o offscreenG
 o offscreenImg
 o parent

Method Index

 o buildCampus()
Macro to build the initial campus walkways
 o Clip()
Tells the status of the select rectangle
 o DrawingMode()
 o DrawingMode(int)
Set's Drawing Mode
 o keyDown(Event, int)
 o mouseDown(Event, int, int)
Mouse Down Event Handler
 o mouseDrag(Event, int, int)
Mouse Drag Event Handler
 o mouseUp(Event, int, int)
Mouse Up Event Handler
 o paint(Graphics)
Paints the canvas with the graph, and select rectangle (if visible), and sketch line (if creating an edge).
 o resize(int)
Resize all the nodes on the display
 o SetClip(boolean)
Sets the select rectangle to be visible or not
 o update(Graphics)
Update Routine- does not need to clear buffer since we are going to copy buffer while double buffering

Variables

 o CREATE
  public final int CREATE
 o EDIT
  public final int EDIT
 o offscreenImg
  public Image offscreenImg
 o offscreenG
  public Graphics offscreenG
 o parent
  protected IWalkways parent

Methods

 o DrawingMode
  public int DrawingMode()
 o DrawingMode
  public void DrawingMode(int m)
Set's Drawing Mode
Parameters:
m - Drawing mode
 o Clip
  public boolean Clip()
Tells the status of the select rectangle
Returns:
boolean- true if on (visible), false if off (not displayed)
 o SetClip
  public void SetClip(boolean cl)
Sets the select rectangle to be visible or not
Parameters:
cl - clip rectangle status- true visible, false invisible
 o update
  public void update(Graphics g)
Update Routine- does not need to clear buffer since we are going to copy buffer while double buffering
Parameters:
g - graphics to draw into
Overrides:
update in class Component
 o mouseUp
  public boolean mouseUp(Event evt,
                         int x,
                         int y)
Mouse Up Event Handler
Parameters:
evt - event to be handled
x - x mouse position
y - y mouse position
Returns:
boolean- true if event handled, (all cases true)
Overrides:
mouseUp in class Component
 o mouseDown
  public boolean mouseDown(Event evt,
                           int x,
                           int y)
Mouse Down Event Handler
Parameters:
x - x mouse position
y - y mouse position
Returns:
boolean- true if event handled, (all cases true)
Overrides:
mouseDown in class Component
 o mouseDrag
  public boolean mouseDrag(Event evt,
                           int x,
                           int y)
Mouse Drag Event Handler
Parameters:
x - x mouse position
y - y mouse position
Returns:
boolean- true if event handled, (all cases true)
Overrides:
mouseDrag in class Component
 o keyDown
  public boolean keyDown(Event evt,
                         int key)
Overrides:
keyDown in class Component
 o buildCampus
  public void buildCampus()
Macro to build the initial campus walkways
 o paint
  public void paint(Graphics g)
Paints the canvas with the graph, and select rectangle (if visible), and sketch line (if creating an edge). Double buffering is done here
Parameters:
g - graphics context
Overrides:
paint in class Canvas
 o resize
  public void resize(int newsize)
Resize all the nodes on the display
Parameters:
newsize - new node size