gov.noaa.pmel.sgt.swing
Class UserIcon

java.lang.Object
  |
  +--javax.swing.ImageIcon
        |
        +--gov.noaa.pmel.sgt.swing.UserIcon
All Implemented Interfaces:
javax.accessibility.Accessible, Draggable, javax.swing.Icon, LayerChild, Selectable, java.io.Serializable

public class UserIcon
extends javax.swing.ImageIcon
implements LayerChild, Draggable

UserIcon extends ImageIcon to create a icon than can be dragged on a sgt plot displaying a user defined text string along with the image.

Since:
2.0
Version:
$Revision: 1.13 $, $Date: 2001/12/13 19:07:06 $
Author:
Donald Denbo
See Also:
ValueIcon, Serialized Form

Constructor Summary
UserIcon(java.awt.Image image, java.lang.String description)
          Construct a UserIcon using an Image.
UserIcon(java.lang.String filename, java.lang.String description)
          Construct a UserIcon using an image from a specified file.
UserIcon(java.net.URL location, java.lang.String description)
          Construct a UserIcon using an image from a specified URL.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void addVetoableChangeListener(java.beans.VetoableChangeListener l)
           
 LayerChild copy()
          Create a copy of the LayerChild.
 void draw(java.awt.Graphics g)
          Draw the LayerChild.
 java.awt.Rectangle getBounds()
          Gets the bounding rectangle in device coordinates.
 java.awt.Font getFont()
          Get the value label font
 int getIconHeight()
          Get the total heigth.
 int getIconWidth()
          Get the total width, icon + label.
 java.lang.String getId()
          Get the identifier.
 Layer getLayer()
          Get the associated Layer.
 Point2D.Double getLocationP()
          Get the icon location in physical units.
 Point2D.Double getLocationU()
          Get the icon location in user units.
 AbstractPane getPane()
          Get AbstractPane of the LayerChild.
 boolean isSelectable()
          Returns true if the current state is selectable.
 boolean isSelected()
          Returns true if the object's selected property is set.
 boolean isVisible()
          Check if LayerChild is visible.
 void modified(java.lang.String mess)
          Used by sgt internally.
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Paint the icon at the specified location.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
           
 void removeVetoableChangeListener(java.beans.VetoableChangeListener l)
           
 void setBounds(int x, int y, int width, int height)
          Set icon bounds.
 void setBounds(java.awt.Rectangle bounds)
          Set icon bounds.
 void setFont(java.awt.Font font)
          Set the font for the value label.
 void setId(java.lang.String id)
          Set the identifier.
 void setLayer(Layer l)
          Associate a Layer with the LayerChild.
 void setLocation(java.awt.Point loc)
          Set icon location in device units
 void setLocationNoVeto(int x, int y)
          Set icon location in device coordinates.
 void setLocationP(Point2D.Double loc)
          Set the icon location in physical units.
 void setLocationU(Point2D.Double loc)
          Set the icon location in user units.
 void setLocationUNoVeto(Point2D.Double loc)
          Set the icon location in user units.
 void setSelectable(boolean select)
          Set the Selectable property.
 void setSelected(boolean sel)
          Sets the selected property.
 void setVisible(boolean vis)
          Set visibility for a LayerChild.
 java.lang.String toString()
          Return a string that represents the LayerChild.
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getImage, getImageLoadStatus, getImageObserver, setDescription, setImage, setImageObserver
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserIcon

public UserIcon(java.lang.String filename,
                java.lang.String description)
Construct a UserIcon using an image from a specified file.
Parameters:
filename - name of image file
description - brief textual description of the image

UserIcon

public UserIcon(java.net.URL location,
                java.lang.String description)
Construct a UserIcon using an image from a specified URL.
Parameters:
location - URL of image file
description - brief textual description of the image

UserIcon

public UserIcon(java.awt.Image image,
                java.lang.String description)
Construct a UserIcon using an Image.
Parameters:
image - the image
description - brief textual description of the image
Method Detail

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Paint the icon at the specified location.
Overrides:
paintIcon in class javax.swing.ImageIcon
Following copied from class: javax.swing.ImageIcon
Parameters:
c - the component to be used as the observer if this icon has no image observer
g - the graphics context
x - the X coordinate of the icon's top-left corner
y - the Y coordinate of the icon's top-left corner

setFont

public void setFont(java.awt.Font font)
Set the font for the value label.
Parameters:
font - the font

getFont

public java.awt.Font getFont()
Get the value label font

getIconWidth

public int getIconWidth()
Get the total width, icon + label.
Overrides:
getIconWidth in class javax.swing.ImageIcon
Following copied from class: javax.swing.ImageIcon
Returns:
the width in pixels of this icon

getIconHeight

public int getIconHeight()
Get the total heigth.
Overrides:
getIconHeight in class javax.swing.ImageIcon
Following copied from class: javax.swing.ImageIcon
Returns:
the height in pixels of this icon

copy

public LayerChild copy()
Description copied from interface: LayerChild
Create a copy of the LayerChild.
Specified by:
copy in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
A copy of the LayerChild.

setVisible

public void setVisible(boolean vis)
Description copied from interface: LayerChild
Set visibility for a LayerChild.
Specified by:
setVisible in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
visible - visible if true

isVisible

public boolean isVisible()
Description copied from interface: LayerChild
Check if LayerChild is visible.
Specified by:
isVisible in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
true if visible

draw

public void draw(java.awt.Graphics g)
Description copied from interface: LayerChild
Draw the LayerChild.
Specified by:
draw in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
g - Graphics context
Throws:
LayerNotFoundException - No layer is associated with the LayerChild.

getId

public java.lang.String getId()
Description copied from interface: LayerChild
Get the identifier.
Specified by:
getId in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
LayerChild identification.

getLayer

public Layer getLayer()
Description copied from interface: LayerChild
Get the associated Layer.
Specified by:
getLayer in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
Associated layer

getPane

public AbstractPane getPane()
Description copied from interface: LayerChild
Get AbstractPane of the LayerChild.
Specified by:
getPane in interface LayerChild

modified

public void modified(java.lang.String mess)
Description copied from interface: LayerChild
Used by sgt internally.
Specified by:
modified in interface LayerChild

setId

public void setId(java.lang.String id)
Description copied from interface: LayerChild
Set the identifier.
Specified by:
setId in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
id - LayerChild identification.

setLayer

public void setLayer(Layer l)
Description copied from interface: LayerChild
Associate a Layer with the LayerChild.
Specified by:
setLayer in interface LayerChild
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Parameters:
l - Parent layer.

toString

public java.lang.String toString()
Description copied from interface: LayerChild
Return a string that represents the LayerChild.
Specified by:
toString in interface LayerChild
Overrides:
toString in class javax.swing.ImageIcon
Following copied from interface: gov.noaa.pmel.sgt.LayerChild
Returns:
Stringified LayerChild representation.

getBounds

public java.awt.Rectangle getBounds()
Description copied from interface: Selectable
Gets the bounding rectangle in device coordinates.
Specified by:
getBounds in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Returns:
bounding rectangle

isSelected

public boolean isSelected()
Description copied from interface: Selectable
Returns true if the object's selected property is set.
Specified by:
isSelected in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Returns:
true if selected, false if not.

setSelected

public void setSelected(boolean sel)
Description copied from interface: Selectable
Sets the selected property.
Specified by:
setSelected in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Parameters:
sel - true if selected, false if not.

isSelectable

public boolean isSelectable()
Description copied from interface: Selectable
Returns true if the current state is selectable.
Specified by:
isSelectable in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Returns:
true if selectable

setSelectable

public void setSelectable(boolean select)
Description copied from interface: Selectable
Set the Selectable property.
Specified by:
setSelectable in interface Selectable
Following copied from interface: gov.noaa.pmel.sgt.Selectable
Parameters:
select - if true object is selectable

getLocationP

public Point2D.Double getLocationP()
Get the icon location in physical units.

setLocationP

public void setLocationP(Point2D.Double loc)
Set the icon location in physical units.
Property Change: location.

getLocationU

public Point2D.Double getLocationU()
Get the icon location in user units.

setLocationUNoVeto

public void setLocationUNoVeto(Point2D.Double loc)
Set the icon location in user units. Location change can't be vetoed.

setLocationU

public void setLocationU(Point2D.Double loc)
                  throws java.beans.PropertyVetoException
Set the icon location in user units. Location change can be vetoed.
Property Change: location.

setLocationNoVeto

public void setLocationNoVeto(int x,
                              int y)
Set icon location in device coordinates. Locatoin change can't be vetoed.
Specified by:
setLocationNoVeto in interface Draggable

setLocation

public void setLocation(java.awt.Point loc)
Set icon location in device units
Specified by:
setLocation in interface Draggable

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Set icon bounds.
Property Change: location.

setBounds

public void setBounds(java.awt.Rectangle bounds)
Set icon bounds.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener l)

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener l)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)


Send comments about the Scientific Graphics toolkit to dwd@pmel.noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on December 13 2001