sgtplot.swing
Class ValueIcon
- java.lang.Object
-
- javax.swing.ImageIcon
-
- sgtplot.swing.ValueIcon
-
- All Implemented Interfaces:
- java.io.Serializable, javax.accessibility.Accessible, javax.swing.Icon, LayerChild, Selectable, Draggable
public class ValueIcon extends javax.swing.ImageIcon implements LayerChild, Draggable
ValueIconextendsImageIconto create a icon than can be dragged on asgtplotplot displaying the local coordinates along with the image. Typically a cross-hairs image is used, but others can be substituted.- Since:
- 2.0
- See Also:
UserIcon,ValueIconFormat, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ValueIcon(java.awt.Image image, java.lang.String description)Construct aValueIconusing anImage.ValueIcon(java.lang.String filename, java.lang.String description)Construct aValueIconusing an image from a specified file.ValueIcon(java.net.URL location, java.lang.String description)Construct aValueIconusing an image from a specifiedURL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)voidaddVetoableChangeListener(java.beans.VetoableChangeListener l)LayerChildcopy()Create a copy of theLayerChild.voiddraw(org.freehep.graphics2d.VectorGraphics g)Draw theLayerChild.java.awt.RectanglegetBounds()Gets the bounding rectangle in device coordinates.java.awt.FontgetFont()Get the value label fontintgetIconHeight()Get the total heigth.intgetIconWidth()Get the total width, icon + label.java.lang.StringgetId()Get the identifier.LayergetLayer()Get the associatedLayer.Point2D.DoublegetLocationP()Get the icon location in physical units.SoTPointgetLocationU()Get the icon location in user units.AbstractPanegetPane()GetAbstractPaneof theLayerChild.booleanisSelectable()Returns true if the current state is selectable.booleanisSelected()Returns true if the object's selected property is set.booleanisVisible()Check ifLayerChildis visible.voidmodified(java.lang.String mess)Used by sgtplot internally.voidpaintIcon(java.awt.Component c, org.freehep.graphics2d.VectorGraphics g2, int x, int y)Paint the icon at the specified location.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)voidremoveVetoableChangeListener(java.beans.VetoableChangeListener l)voidsetBounds(int x, int y, int width, int height)Set icon bounds.voidsetBounds(java.awt.Rectangle bounds)Set icon bounds.voidsetFont(java.awt.Font font)Set the font for the value label.voidsetId(java.lang.String id)Set the identifier.voidsetLayer(Layer l)Associate aLayerwith theLayerChild.voidsetLocation(java.awt.Point loc)Set icon location in device unitsvoidsetLocation(java.awt.Point loc, boolean fireEvent)Set icon location in device units and optionally fire aPropertyChangeEvent.voidsetLocationNoVeto(int x, int y)Set icon location in device coordinates.voidsetLocationP(Point2D.Double loc)Set the icon location in physical units.voidsetLocationU(SoTPoint loc)Set the icon location in user units.voidsetLocationUNoVeto(SoTPoint loc)Set the icon location in user units.voidsetSelectable(boolean select)Set the Selectable property.voidsetSelected(boolean sel)Sets the selected property.voidsetValueFormat(ValueIconFormat vf)Set format to be used to create the value string.voidsetVisible(boolean vis)Set visibility for aLayerChild.java.lang.StringtoString()Return a string that represents theLayerChild.
-
-
-
Constructor Detail
-
ValueIcon
public ValueIcon(java.lang.String filename, java.lang.String description)Construct aValueIconusing an image from a specified file.- Parameters:
filename- name of image filedescription- brief textual description of the image
-
ValueIcon
public ValueIcon(java.net.URL location, java.lang.String description)Construct aValueIconusing an image from a specifiedURL.- Parameters:
location- URL of image filedescription- brief textual description of the image
-
ValueIcon
public ValueIcon(java.awt.Image image, java.lang.String description)Construct aValueIconusing anImage.- Parameters:
image- the imagedescription- brief textual description of the image
-
-
Method Detail
-
setValueFormat
public void setValueFormat(ValueIconFormat vf)
Set format to be used to create the value string. Default format isnew ValueIconFormat("#####.##", "#").- Parameters:
the- value format
-
paintIcon
public void paintIcon(java.awt.Component c, org.freehep.graphics2d.VectorGraphics g2, int x, int y)Paint the icon at the specified location.
-
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.- Specified by:
getIconWidthin interfacejavax.swing.Icon- Overrides:
getIconWidthin classjavax.swing.ImageIcon
-
getIconHeight
public int getIconHeight()
Get the total heigth.- Specified by:
getIconHeightin interfacejavax.swing.Icon- Overrides:
getIconHeightin classjavax.swing.ImageIcon
-
copy
public LayerChild copy()
Description copied from interface:LayerChildCreate a copy of theLayerChild.- Specified by:
copyin interfaceLayerChild- Returns:
- A copy of the
LayerChild.
-
setVisible
public void setVisible(boolean vis)
Description copied from interface:LayerChildSet visibility for aLayerChild.- Specified by:
setVisiblein interfaceLayerChild- Parameters:
vis- visible if true
-
isVisible
public boolean isVisible()
Description copied from interface:LayerChildCheck ifLayerChildis visible.- Specified by:
isVisiblein interfaceLayerChild- Returns:
- true if visible
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g)
Description copied from interface:LayerChildDraw theLayerChild.- Specified by:
drawin interfaceLayerChild- Parameters:
g- Graphics context
-
getId
public java.lang.String getId()
Description copied from interface:LayerChildGet the identifier.- Specified by:
getIdin interfaceLayerChild- Returns:
LayerChildidentification.
-
getLayer
public Layer getLayer()
Description copied from interface:LayerChildGet the associatedLayer.- Specified by:
getLayerin interfaceLayerChild- Returns:
- Associated layer
-
getPane
public AbstractPane getPane()
Description copied from interface:LayerChildGetAbstractPaneof theLayerChild.- Specified by:
getPanein interfaceLayerChild
-
modified
public void modified(java.lang.String mess)
Description copied from interface:LayerChildUsed by sgtplot internally.- Specified by:
modifiedin interfaceLayerChild
-
setId
public void setId(java.lang.String id)
Description copied from interface:LayerChildSet the identifier.- Specified by:
setIdin interfaceLayerChild- Parameters:
id-LayerChildidentification.
-
setLayer
public void setLayer(Layer l)
Description copied from interface:LayerChildAssociate aLayerwith theLayerChild.- Specified by:
setLayerin interfaceLayerChild- Parameters:
l- Parent layer.
-
toString
public java.lang.String toString()
Description copied from interface:LayerChildReturn a string that represents theLayerChild.- Specified by:
toStringin interfaceLayerChild- Overrides:
toStringin classjavax.swing.ImageIcon- Returns:
- Stringified
LayerChildrepresentation.
-
getBounds
public java.awt.Rectangle getBounds()
Description copied from interface:SelectableGets the bounding rectangle in device coordinates.- Specified by:
getBoundsin interfaceSelectable- Returns:
- bounding rectangle
-
isSelected
public boolean isSelected()
Description copied from interface:SelectableReturns true if the object's selected property is set.- Specified by:
isSelectedin interfaceSelectable- Returns:
- true if selected, false if not.
-
setSelected
public void setSelected(boolean sel)
Description copied from interface:SelectableSets the selected property.- Specified by:
setSelectedin interfaceSelectable- Parameters:
sel- true if selected, false if not.
-
isSelectable
public boolean isSelectable()
Description copied from interface:SelectableReturns true if the current state is selectable.- Specified by:
isSelectablein interfaceSelectable- Returns:
- true if selectable
-
setSelectable
public void setSelectable(boolean select)
Description copied from interface:SelectableSet the Selectable property.- Specified by:
setSelectablein interfaceSelectable- 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 SoTPoint getLocationU()
Get the icon location in user units.- Since:
- 3.0
-
setLocationUNoVeto
public void setLocationUNoVeto(SoTPoint loc)
Set the icon location in user units. Location change can't be vetoed.- Since:
- 3.0
-
setLocationU
public void setLocationU(SoTPoint loc) throws java.beans.PropertyVetoException
Set the icon location in user units. Location change can be vetoed.
Property Change:location.- Throws:
java.beans.PropertyVetoException- Since:
- 3.0
-
setLocationNoVeto
public void setLocationNoVeto(int x, int y)Set icon location in device coordinates. Locatoin change can't be vetoed.- Specified by:
setLocationNoVetoin interfaceDraggable
-
setLocation
public void setLocation(java.awt.Point loc)
Set icon location in device units- Specified by:
setLocationin interfaceDraggable
-
setLocation
public void setLocation(java.awt.Point loc, boolean fireEvent)Set icon location in device units and optionally fire aPropertyChangeEvent.- Specified by:
setLocationin interfaceDraggable- Since:
- 3.0
-
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)
-
-
DMelt 3.0 © DataMelt by jWork.ORG