All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calypso.clients.tv.ImageCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----calypso.clients.tv.ImageCanvas

public class ImageCanvas
extends Canvas
This class implements an imagemap of the remote to help demostration. The image given in a constructor is displayed on the given canvas, and is maped by rectangles given in the RECT array. The idea is that a rectangle is drawn according to cordinates in an array element, if argument given in method buttonPressed matches the first token of an the same array element. It is used with the class EventDisplay.

Author:
Kim Lahti / TCM laboratory / HUT
See Also:
EventDisplay

Variable Index

 o h
Height of the ImageCanvas.
 o image
Image object for the canvas.
 o lastrect
Reference to the last drawn ButtonRectangle.
 o lighton
Check variable indicating if the light is on.
 o minSize
Dimension object holding the minimum size information of the canvas.
 o pappy
The parent container of the ImageCanvas.
 o RECT
An array containing the button windows information.
 o rects
Vector data structure holding the rectangles.
 o t2
Thread object of the ImageCanvas.
 o trueSizeKnown
Check variable indicating if the true size of the ImageCanvas is known.
 o w
Width of the ImageCanvas.

Constructor Index

 o ImageCanvas(String, Container, int, int)
The class constructor, gets the image and the background rectangles.

Method Index

 o buttonPressed(String)
Method to be called when remote notifies an event.
 o dispose()
A method used to free recourses.
 o findrect(String)
A method used to find the right rectangle.
 o getRectangleParameter(String)
Parse a comma-separated list of a button name and rectangle cordinates.
 o getSize()
Method to get the images real size.
 o paint(Graphics)
The paint method to draw the image and the background rectangles.
 o update(Graphics)
Overriding method update to cause less flickering.

Variables

 o pappy
 protected Container pappy
The parent container of the ImageCanvas.

 o image
 protected Image image
Image object for the canvas.

 o trueSizeKnown
 protected boolean trueSizeKnown
Check variable indicating if the true size of the ImageCanvas is known.

 o minSize
 protected Dimension minSize
Dimension object holding the minimum size information of the canvas.

 o w
 protected int w
Width of the ImageCanvas.

 o h
 protected int h
Height of the ImageCanvas.

 o rects
 protected Vector rects
Vector data structure holding the rectangles.

 o t2
 protected Thread t2
Thread object of the ImageCanvas.

 o lighton
 protected static boolean lighton
Check variable indicating if the light is on.

 o lastrect
 protected static ButtonRectangle lastrect
Reference to the last drawn ButtonRectangle.

 o RECT
 public static final String RECT[]
An array containing the button windows information.

Constructors

 o ImageCanvas
 public ImageCanvas(String images_,
                    Container parent_,
                    int initialWidth_,
                    int initialHeight_)
The class constructor, gets the image and the background rectangles.

Parameters:
images_ - The name of the image to be fetched.
parent_ - The parent container.
initialWidth_ - The ImageCanvas width.
initialHeight_ - The ImageCanvas height.

Methods

 o getSize
 public synchronized Dimension getSize()
Method to get the images real size.

Returns:
The dimension object holding the requested size.
Overrides:
getSize in class Component
 o paint
 public void paint(Graphics g_)
The paint method to draw the image and the background rectangles.

Parameters:
g_ - The graphics object to which Image is to be drawn.
Overrides:
paint in class Canvas
 o update
 public void update(Graphics g_)
Overriding method update to cause less flickering.

Parameters:
g_ - The graphics object to which image is to be drawn.
Overrides:
update in class Component
 o getRectangleParameter
 public ButtonRectangle getRectangleParameter(String name_)
Parse a comma-separated list of a button name and rectangle cordinates. This method is used to parse the RECT array to ButtonRectangle objects, which are listed into the rects vector.

Parameters:
name_ - The name identifying the desired button.
Returns:
The newly constructed ButtonRectangle object.
 o buttonPressed
 public void buttonPressed(String command_)
Method to be called when remote notifies an event. This method makes the light and the rectangles around the buttons to work properly.

Parameters:
command_ - Event spesific command indicating the pressed button.
 o findrect
 public ButtonRectangle findrect(String command_)
A method used to find the right rectangle.

Parameters:
command_ - Event spesific command indicating the pressed button.
 o dispose
 public void dispose()
A method used to free recourses.


All Packages  Class Hierarchy  This Package  Previous  Next  Index