All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.eou.swingimageregionselector.ImageRegionSelector

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.ibm.eou.swingimageregionselector.ImageRegionSelector

public class ImageRegionSelector
extends JComponent
implements MouseListener, MouseMotionListener, ItemSelectable, Serializable
The ImageRegionSelector is a bean which allows the selection of pre-defined regions of an image which is displayed to the user. The image the user sees (the "display" image) is referenced by a second image, the "color map" image, which represents the separate selectable regions of the display image in a given sequence of colors. The color map image is used for hit-correlation to detect which display image region has been selected or rolled over. For example if the mouse is clicked on pixel (100,150) on the display image the color of the pixel at (100,150) in the color map image is taken. This color, if the color map image has been correctly created, will be one of the colors in the ordered set of valid index colors. The index of the valid color is returned and is stored as the currently selected region.
The ImageRegionSelector also supports the highlighting of selected regions (mouse clicked inside a region) and rollover regions (mouse moved within a region) to show clearly to the user which areas have been selected. Additionally, tooltips are supported to give the user a short textual desription when the mouse hovers over a particular region.
The ImageRegionSelector bean has the following nine properties: The selection and rollover emphasis style properties should be set to one of the following values: The ImageRegionSelector implements the java.awt.ItemSelectable interface which provides a standard mechanism for other java components to interact with the ImageRegionSelector. The ImageRegionSelector fires java.awt.event.ItemEvent events when regions are selected or deselected - which are received by any component that implements the java.awt.event.ItemListener interface and has added itself to the ImageRegionSelector as an item listener via the addItemListener method.


Variable Index

 o CUTAWAY
Show cutaway image through selected or rollover region
 o DARKEN
Darken selected or rollover region
 o LIGHTEN
Lighten selected or rollover region
 o NEGATIVE
Show selected or rollover region in negative
 o NONE
No image emphasis

Constructor Index

 o ImageRegionSelector()
ImageRegionSelector constructor

Method Index

 o addItemListener(ItemListener)
Registers a component as an item listener so it can receive item events from the ImageRegionSelector
 o addNotify()
Method is called when the ImageRegionSelector is added to its parent
 o copyright()
IBM Copyright statement
 o getColorMapImage()
Returns the name of the color map image
 o getCutawayImage()
Returns the name of the cutaway image
 o getDisplayImage()
Returns the name of the display image
 o getRegionNames()
Returns the array of region names.
 o getRegionNamesList()
Returns the region names in a StringList object - used within the visual builder.
 o getRolloverEmphasisStyle()
Returns the current rollover emphasis style
 o getSelectedIndex()
Returns the index of the selected region
 o getSelectedItem()
Gets the region name corresponding to the selected region.
 o getSelectedObjects()
Taken from the ItemSelectable interface.
 o getSelectionEmphasisStyle()
Returns the current selection emphasis style
 o getTooltipList()
Returns an array of tooltip strings wrapped in a StringList class
 o getTooltips()
Returns the tooltip strings as an array
 o getToolTipText(MouseEvent)
Sets the string to be displayed on the tooltip for the given MouseEvent
 o imageUpdate(Image, int, int, int, int, int)
Taken from the ImageObserver interface and is used to control the painting of a filtered image.
 o mouseClicked(MouseEvent)
From the MouseListener interface - captures mouse clicked events
 o mouseDragged(MouseEvent)
From the MouseMotionListener interface - captures mouse dragged events
 o mouseEntered(MouseEvent)
From the MouseListener interface - captures mouse entered events
 o mouseExited(MouseEvent)
From the MouseListener interface - captures mouse exited events
 o mouseMoved(MouseEvent)
From the MouseMotionListener interface - captures mouse moved events
 o mousePressed(MouseEvent)
From the MouseListener interface - captures mouse pressed events
 o mouseReleased(MouseEvent)
From the MouseListener interface - captures mouse released events
 o paintComponent(Graphics)
paints the ImageRegionSelector
 o removeItemListener(ItemListener)
Removes the component as an item listener - no longer wants to receive events from the image picker
 o setColorMapImage(String)
Sets the color map image to be the image of the the file name specified
 o setCutawayImage(String)
Sets the cutaway image to be the image of the the file name specified
 o setDisplayImage(String)
Sets the display image to be the image of the the file name specified
 o setRegionNames(String[])
Sets the array of region names
 o setRegionNamesList(StringList)
Sets the array of region names as a StringList object - used in the visual builder
 o setRolloverEmphasisStyle(int)
Sets the rollover emphasis style to be used.
 o setSelectedIndex(int)
Specifies the region to be selected
 o setSelectionEmphasisStyle(int)
Sets the selection emphasis style to be used.
 o setTooltipList(StringList)
Sets the tooltips to be the new StringList object
 o setTooltips(String[])
Sets the tooltips to be the values in the String array given

Variables

 o NONE
 public static final int NONE
No image emphasis

 o LIGHTEN
 public static final int LIGHTEN
Lighten selected or rollover region

 o DARKEN
 public static final int DARKEN
Darken selected or rollover region

 o NEGATIVE
 public static final int NEGATIVE
Show selected or rollover region in negative

 o CUTAWAY
 public static final int CUTAWAY
Show cutaway image through selected or rollover region

Constructors

 o ImageRegionSelector
 public ImageRegionSelector()
ImageRegionSelector constructor

Methods

 o addItemListener
 public void addItemListener(ItemListener il)
Registers a component as an item listener so it can receive item events from the ImageRegionSelector

Parameters:
il - Component to listen for item events
 o addNotify
 public void addNotify()
Method is called when the ImageRegionSelector is added to its parent

Overrides:
addNotify in class JComponent
 o copyright
 public static String copyright()
IBM Copyright statement

 o getColorMapImage
 public String getColorMapImage()
Returns the name of the color map image

Returns:
Name of the color map image
 o getCutawayImage
 public String getCutawayImage()
Returns the name of the cutaway image

Returns:
The name of the cutaway image
 o getDisplayImage
 public String getDisplayImage()
Returns the name of the display image

Returns:
The name of the display image
 o getRegionNames
 public String[] getRegionNames()
Returns the array of region names.

Returns:
java.lang.String[] The names of the regions
 o getRegionNamesList
 public StringList getRegionNamesList()
Returns the region names in a StringList object - used within the visual builder.

Returns:
com.ibm.eou.swingimageregionselector..StringList Region names
 o getRolloverEmphasisStyle
 public int getRolloverEmphasisStyle()
Returns the current rollover emphasis style

Returns:
The rollover emphasis style
 o getSelectedIndex
 public int getSelectedIndex()
Returns the index of the selected region

Returns:
The index of the selected region
 o getSelectedItem
 public Object getSelectedItem()
Gets the region name corresponding to the selected region.

Returns:
java.lang.Object Name of the selected region
 o getSelectedObjects
 public Object[] getSelectedObjects()
Taken from the ItemSelectable interface. The ImageRegionSelector supports only single selection which means the return value is an array of Objects with only one element - the selected index

Returns:
Array containing only the index of the selected region - or null if no region is selected
 o getSelectionEmphasisStyle
 public int getSelectionEmphasisStyle()
Returns the current selection emphasis style

Returns:
The selection emphasis style
 o getTooltipList
 public StringList getTooltipList()
Returns an array of tooltip strings wrapped in a StringList class

Returns:
StringList object containing the tooltip strings
 o getTooltips
 public String[] getTooltips()
Returns the tooltip strings as an array

Returns:
Array of tooltip values
 o getToolTipText
 public String getToolTipText(MouseEvent e)
Sets the string to be displayed on the tooltip for the given MouseEvent

Parameters:
e - MouseEvent that triggered the request for a new tooltip value
Returns:
String to appear on the tooltip
Overrides:
getToolTipText in class JComponent
 o imageUpdate
 public boolean imageUpdate(Image img,
                            int flags,
                            int x,
                            int y,
                            int width,
                            int height)
Taken from the ImageObserver interface and is used to control the painting of a filtered image. This method is called when prepareImage is called for an image being filtered to record when the filtering is complete. A repaint request is made only when the image is complete

Parameters:
img - The image being observed
flags - The latest state of the image
x - known x position of the image
y - known y position of the image
width - known width of the image
height - known height of the image
Returns:
updated image status information
Overrides:
imageUpdate in class Component
 o mouseClicked
 public void mouseClicked(MouseEvent e)
From the MouseListener interface - captures mouse clicked events

Parameters:
e - mouse event
 o mouseDragged
 public void mouseDragged(MouseEvent e)
From the MouseMotionListener interface - captures mouse dragged events

Parameters:
e - mouse event
 o mouseEntered
 public void mouseEntered(MouseEvent e)
From the MouseListener interface - captures mouse entered events

Parameters:
e - mouse event
 o mouseExited
 public void mouseExited(MouseEvent e)
From the MouseListener interface - captures mouse exited events

Parameters:
e - mouse event
 o mouseMoved
 public void mouseMoved(MouseEvent e)
From the MouseMotionListener interface - captures mouse moved events

Parameters:
e - mouse event
 o mousePressed
 public void mousePressed(MouseEvent e)
From the MouseListener interface - captures mouse pressed events

Parameters:
e - mouse event
 o mouseReleased
 public void mouseReleased(MouseEvent e)
From the MouseListener interface - captures mouse released events

Parameters:
e - mouse event
 o paintComponent
 public void paintComponent(Graphics g)
paints the ImageRegionSelector

Parameters:
g - ImageRegionSelector's graphics context
Overrides:
paintComponent in class JComponent
 o removeItemListener
 public void removeItemListener(ItemListener il)
Removes the component as an item listener - no longer wants to receive events from the image picker

Parameters:
il - Component to be removed
 o setColorMapImage
 public void setColorMapImage(String newValue)
Sets the color map image to be the image of the the file name specified

Parameters:
newValue - File name of image
 o setCutawayImage
 public void setCutawayImage(String newValue)
Sets the cutaway image to be the image of the the file name specified

Parameters:
newValue - File name of image
 o setDisplayImage
 public void setDisplayImage(String newValue)
Sets the display image to be the image of the the file name specified

Parameters:
newValue - File name of image
 o setRegionNames
 public void setRegionNames(String newValue[])
Sets the array of region names

Parameters:
newValue - java.lang.String[] Array of region names
 o setRegionNamesList
 public void setRegionNamesList(StringList newValue)
Sets the array of region names as a StringList object - used in the visual builder

Parameters:
newValue - java.lang.String[] StringList object of the region names
 o setRolloverEmphasisStyle
 public void setRolloverEmphasisStyle(int newValue)
Sets the rollover emphasis style to be used. Should be set to one of the following values:

Parameters:
newValue - new rollover emphasis style setting
 o setSelectedIndex
 public void setSelectedIndex(int index)
Specifies the region to be selected

Parameters:
index - Region to be selected
 o setSelectionEmphasisStyle
 public void setSelectionEmphasisStyle(int newValue)
Sets the selection emphasis style to be used. Should be set to one of the following values:

Parameters:
newValue - new selection emphasis style setting
 o setTooltipList
 public void setTooltipList(StringList values)
Sets the tooltips to be the new StringList object

Parameters:
values - New tooltip values
 o setTooltips
 public void setTooltips(String newValue[])
Sets the tooltips to be the values in the String array given

Parameters:
newValue - Array of new tooltip values

All Packages  Class Hierarchy  This Package  Previous  Next  Index