Up: Java Kali Home Page

Class DrawPanel

Class DrawPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----DrawPanel

class DrawPanel
extends Panel
The DrawPanel object is Kali's actual drawing area. It receives and handles the mouse events related to drawing, maintains the list of line segments that have been drawn (and their colors), keeps track of whether we're drawing a temporary segment (the segment that follows the mouse during drawing), and if so, its coordinates.

The screen is drawn in Kali whenever the system calls the DrawPanel's paint() method; this method goes through the list of current segments, and calls the Panorama's drawSegement() method for each one.


Constructor Index

 o DrawPanel(Panorama, KaliCanvas)
Create a new DrawPanel object.

Method Index

 o clear()
Erase the screen and clear the list of segments
 o handleEvent(Event)
Handle mouse events
 o paint(Graphics)
Paint the panel, by looping through all the segements and calling the panorama object's drawSegment() method for each one.
 o update(Graphics)
Update the screen, with doublebuffering.

Constructors

 o DrawPanel
  public DrawPanel(Panorama panorama,
                   KaliCanvas kaliCanvas)
Create a new DrawPanel object.
Parameters:
panorama - The Panorama object that this DrawPanel relates to.
kaliCanvas - The KaliCanvas object that this DrawPanel relates to.

Methods

 o clear
  public void clear()
Erase the screen and clear the list of segments
 o handleEvent
  public boolean handleEvent(Event e)
Handle mouse events
Overrides:
handleEvent in class Component
 o paint
  public void paint(Graphics g)
Paint the panel, by looping through all the segements and calling the panorama object's drawSegment() method for each one.
Overrides:
paint in class Component
 o update
  public void update(Graphics screeng)
Update the screen, with doublebuffering.
Overrides:
update in class Component


Up: Java Kali Home Page

[HOME] The Geometry Center Home Page

Author: Mark Phillips
Comments to: webmaster@geom.umn.edu
Created: Sep 18 1996 --- Last modified: Sep 18 1996