All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class picture.Picture

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----GWin
                                   |
                                   +----Project
                                           |
                                           +----picture.Picture

public class Picture
extends Project
Draw an image and allow user to zoom in on portions. When the picture is a gallery of many little pictures, it allows one to be zoomed in on with a single mouse click. Thereafter, a click and drag or number key zooms. Many of the numerical constants have a suffix f because the compiler, in direct violation of the spec, assumes they are double by default.

This code is (c) 1996 Leemon Baird <leemon@cs.cmu.edu>, http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely. If the code is modified, please state so in the comments.

Version:
1.0, 11/23/95
Author:
Leemon Baird

Variable Index

 o bar
 o bHeight
 o both
 o component
 o CR
 o currGallery
 o fadeIn
 o gHeight
 o gWidth
 o LF
 o maxX
 o maxY
 o mdownx
 o mdowny
 o mdragx
 o mdragy
 o minX
 o minY
 o pass1
 o pass2

Constructor Index

 o Picture()

Method Index

 o BNF(int)
 o handleEvent(Event)
ensure that events are handled sequentially
 o keyDown(Event, int)
If a key is pressed, respond appropriately.
 o mouseDown(Event, int, int)
Remember where mouse clicks so highlighting will be right.
 o mouseDrag(Event, int, int)
As mouse is dragged, highlight appropriate region.
 o mouseUp(Event, int, int)
When mouse is released, zoom in on appropriate region.
 o paint(Graphics)
paint the screen from the buffer without stopping the drawing thread.
 o parse(Parser, int)
Parse the input file to get the parameters for this object.
 o reshape(int, int, int, int)
when the user resizes or moves the canvas, stop and restart the thread
 o run()
Draw picture after done parsing.
 o unparse(Unparser, int)
Output a description of this object that can be parsed with parse().

Variables

 o fadeIn
 protected FadeIn fadeIn
 o CR
 protected static final char CR
 o LF
 protected static final char LF
 o mdownx
 protected int mdownx
 o mdowny
 protected int mdowny
 o mdragx
 protected int mdragx
 o mdragy
 protected int mdragy
 o gWidth
 protected int gWidth
 o gHeight
 protected int gHeight
 o bHeight
 protected IntExp bHeight
 o minX
 protected double minX
 o maxX
 protected double maxX
 o minY
 protected double minY
 o maxY
 protected double maxY
 o currGallery
 protected Gallery currGallery
 o component
 protected Component component
 o pass1
 protected PicPipePipeline pass1
 o pass2
 protected PicPipePipeline pass2
 o both
 protected PicPipePipeline both
 o bar
 protected boolean bar

Constructors

 o Picture
 public Picture()

Methods

 o BNF
 public String BNF(int lang)
Overrides:
BNF in class Project
 o unparse
 public void unparse(Unparser u,
                     int lang)
Output a description of this object that can be parsed with parse().

Overrides:
unparse in class Project
See Also:
Parsable
 o parse
 public Object parse(Parser p,
                     int lang) throws ParserException
Parse the input file to get the parameters for this object.

Throws: ParserException
parser didn't find the required token
Overrides:
parse in class Project
 o run
 public void run()
Draw picture after done parsing. This is in a separate thread.

Overrides:
run in class Project
 o handleEvent
 public boolean handleEvent(Event e)
ensure that events are handled sequentially

Overrides:
handleEvent in class Component
 o reshape
 public void reshape(int x,
                     int y,
                     int w,
                     int h)
when the user resizes or moves the canvas, stop and restart the thread

Overrides:
reshape in class Component
 o paint
 public void paint(Graphics g)
paint the screen from the buffer without stopping the drawing thread.

Overrides:
paint in class GWin
 o mouseDown
 public boolean mouseDown(Event event,
                          int x,
                          int y)
Remember where mouse clicks so highlighting will be right.

Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event event,
                          int x,
                          int y)
As mouse is dragged, highlight appropriate region.

Overrides:
mouseDrag in class Component
 o mouseUp
 public boolean mouseUp(Event event,
                        int x,
                        int y)
When mouse is released, zoom in on appropriate region.

Overrides:
mouseUp in class Component
 o keyDown
 public boolean keyDown(Event event,
                        int key)
If a key is pressed, respond appropriately.

Overrides:
keyDown in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index