All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class graphing.ZoomGraphWindow

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----graphing.GraphWindow
                           |
                           +----graphing.ZoomGraphWindow

public class ZoomGraphWindow
extends GraphWindow
A ZoomGraphWindow is a GraphWindow together with methods to change scale easily (zooming in and zooming out). The mouse draws out a rubber band on the screen and doZoomToBox() snaps the viewing rectangle to this box.


Variable Index

 o bandColor
The color of the rubber band

Constructor Index

 o ZoomGraphWindow()
 o ZoomGraphWindow(double, double, double, double)
Constructs a ZoomGraphWindow with the specified ranges of x and y axes.
 o ZoomGraphWindow(double, double, double, double, double, double)
Constructs a ZoomGraphWindow with the specified ranges of x and y axes.

Method Index

 o bandIsVisible()
 o deleteBand()
 o doZoomIn()
Zooms the viewing rectangle in on the center of the screen.
 o doZoomOut()
Pulls the viewing rectangle back out of the center of the screen.
 o doZoomToBox()
Snaps the viewing rectangle to the rubber band drawn out by the mouse.
 o drawGraph(double, double, double, double, double, double)
Overrides the drawGraph() method of GraphWindow.
 o lostFocus(Event, Object)
When we loose focus, the rubber band vanishes.
 o mouseDown(Event, int, int)
 o mouseDrag(Event, int, int)
 o mouseUp(Event, int, int)
 o paint(Graphics)
 o selects(int, int)
Tells whether the point (x,y) is inside the region selected by the rubber band
 o update(Graphics)
This class overrides Component.update() to reduce flicker

Variables

 o bandColor
  public Color bandColor
The color of the rubber band

Constructors

 o ZoomGraphWindow
  public ZoomGraphWindow(double xMin,
                         double xMax,
                         double xScale,
                         double yMin,
                         double yMax,
                         double yScale)
Constructs a ZoomGraphWindow with the specified ranges of x and y axes. The axes show tickmarks separated by xScale and yScale.

 o ZoomGraphWindow
  public ZoomGraphWindow(double xMin,
                         double xMax,
                         double yMin,
                         double yMax)
Constructs a ZoomGraphWindow with the specified ranges of x and y axes. The axes show no tickmarks.

 o ZoomGraphWindow
  public ZoomGraphWindow()

Methods

 o update
  public void update(Graphics g)
This class overrides Component.update() to reduce flicker

Overrides:
update in class Component
 o paint
  public void paint(Graphics g)
Overrides:
paint in class GraphWindow
 o drawGraph
  public void drawGraph(double xMin,
                        double xMax,
                        double xScale,
                        double yMin,
                        double yMax,
                        double yScale)
Overrides the drawGraph() method of GraphWindow.

Overrides:
drawGraph in class GraphWindow
 o selects
  public boolean selects(int x,
                         int y)
Tells whether the point (x,y) is inside the region selected by the rubber band

 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Overrides:
mouseDown in class Component
 o mouseDrag
  public boolean mouseDrag(Event e,
                           int x,
                           int y)
Overrides:
mouseDrag in class Component
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
Overrides:
mouseUp in class Component
 o lostFocus
  public boolean lostFocus(Event e,
                           Object w)
When we loose focus, the rubber band vanishes. But the window will still be primed for doZoomToBox() if zoomActive is set.

Overrides:
lostFocus in class Component
 o bandIsVisible
  public boolean bandIsVisible()
 o deleteBand
  public void deleteBand()
 o doZoomIn
  public void doZoomIn()
Zooms the viewing rectangle in on the center of the screen.

 o doZoomToBox
  public void doZoomToBox()
Snaps the viewing rectangle to the rubber band drawn out by the mouse.

 o doZoomOut
  public void doZoomOut()
Pulls the viewing rectangle back out of the center of the screen.


All Packages  Class Hierarchy  This Package  Previous  Next  Index