sgtplot
Class Logo
- java.lang.Object
-
- sgtplot.Logo
-
- All Implemented Interfaces:
- java.lang.Cloneable, LayerChild, Moveable, Selectable
public class Logo extends java.lang.Object implements java.lang.Cloneable, LayerChild, Moveable
Logo displays an Image on its parent Layer. Logo implements the LayerChild interface.- Since:
- 1.0
- See Also:
LayerChild
-
-
Field Summary
Fields Modifier and Type Field and Description static intBOTTOMAlign to bottom of Logo.static intCENTERAlign to center of Logo.static intLEFTAlign to left of Logo.static intMIDDLEAlign to middle of Logo.static intRIGHTAlign to right of Logo.static intTOPAlign to top of Logo.
-
Constructor Summary
Constructors Constructor and Description Logo()Default constructor.Logo(Point2D.Double loc, int valign, int halign)Create a Logo object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)Add a new PropertyChangeListener.LayerChildcopy()Create of copy of Logo.voiddraw(org.freehep.graphics2d.VectorGraphics g)Draw the Logo.java.awt.RectanglegetBounds()Get the bounding rectangle.intgetHAlign()Get horizontal alignmentjava.lang.StringgetId()Get Logo identifierjava.net.URLgetImageURL()Get the image URL.LayergetLayer()Get layer.java.awt.PointgetLocation()Gets the location in device coordinates.Point2D.DoublegetLocationP()Get location of logo.AbstractPanegetPane()GetAbstractPaneof theLayerChild.intgetVAlign()Get vertical alignmentbooleanisMoveable()Returns true if the current state is moveablebooleanisSelectable()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.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)Remove a listener.voidsetAlign(int vert, int horz)Set alignment.voidsetBounds(int x, int y, int width, int height)Set the bounds of theLogo
Property Change:location.voidsetBounds(java.awt.Rectangle r)Set the bounds of theLogovoidsetHAlign(int horz)Set horizontal alignmentvoidsetId(java.lang.String id)Set Logo identifier.voidsetImage(java.awt.Image img)Set the Logo image.voidsetImageURL(java.net.URL url)Set the URL for the Logo image.voidsetLayer(Layer l)Set parent layer.voidsetLocation(java.awt.Point loc)Sets the location in device coordinates.voidsetLocationP(Point2D.Double loc)Set location of logo
Property Change:location.voidsetMoveable(boolean moveable)Set the moveable property.voidsetSelectable(boolean select)Set the Selectable property.voidsetSelected(boolean sel)Sets the selected property.voidsetVAlign(int vert)Set vertical alignmentvoidsetVisible(boolean visible)Set visibility for aLayerChild.java.lang.StringtoString()Return a string that represents theLayerChild.
-
-
-
Field Detail
-
TOP
public static final int TOP
Align to top of Logo.- See Also:
- Constant Field Values
-
MIDDLE
public static final int MIDDLE
Align to middle of Logo.- See Also:
- Constant Field Values
-
BOTTOM
public static final int BOTTOM
Align to bottom of Logo.- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
Align to left of Logo.- See Also:
- Constant Field Values
-
CENTER
public static final int CENTER
Align to center of Logo.- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
Align to right of Logo.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Logo
public Logo()
Default constructor. The default location for the Logo is at (0.0, 0.0) and aligned BOTTOM and LEFT.
-
Logo
public Logo(Point2D.Double loc, int valign, int halign)
Create a Logo object. The initial object will not have an associated Image until setImage or setImageURL methods have been invoked. Vertical alignments include TOP, MIDDLE, and BOTTOM. Horizontal alignments include LEFT, CENTER, and RIGHT.- Parameters:
loc- Location of Logovalign- vertical alignmenthalign- horizontal alignment- See Also:
setImageURL(java.net.URL),setImage(java.awt.Image),Image
-
-
Method Detail
-
copy
public LayerChild copy()
Create of copy of Logo.- Specified by:
copyin interfaceLayerChild- Returns:
- A copy of the
LayerChild.
-
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.
-
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.
-
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
-
isSelectable
public boolean isSelectable()
Description copied from interface:SelectableReturns true if the current state is selectable.- Specified by:
isSelectablein interfaceSelectable- Returns:
- true if selectable
-
isMoveable
public boolean isMoveable()
Description copied from interface:MoveableReturns true if the current state is moveable- Specified by:
isMoveablein interfaceMoveable- Returns:
- true if moveable
-
setMoveable
public void setMoveable(boolean moveable)
Description copied from interface:MoveableSet the moveable property.- Specified by:
setMoveablein interfaceMoveable
-
setImageURL
public void setImageURL(java.net.URL url)
Set the URL for the Logo image. The URL or the image must be set.- Parameters:
url- image URL- See Also:
setImage(java.awt.Image)
-
getImageURL
public java.net.URL getImageURL()
Get the image URL. The URL will be null if no imageURL was specified.- Returns:
- the imageURL
-
setImage
public void setImage(java.awt.Image img)
Set the Logo image. The image or the imageURL must be set.- Parameters:
img- Logo image- See Also:
setImageURL(java.net.URL)
-
setLayer
public void setLayer(Layer l)
Set parent layer.- Specified by:
setLayerin interfaceLayerChild- Parameters:
l- parent layer
-
getLayer
public Layer getLayer()
Get layer.- Specified by:
getLayerin interfaceLayerChild- Returns:
- 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)
Set Logo identifier.- Specified by:
setIdin interfaceLayerChild- Parameters:
id- logo identifier
-
getId
public java.lang.String getId()
Get Logo identifier- Specified by:
getIdin interfaceLayerChild- Returns:
- identifier
-
setAlign
public void setAlign(int vert, int horz)Set alignment.- Parameters:
vert- vertical alignmenthorz- horizontal alignment
-
setVAlign
public void setVAlign(int vert)
Set vertical alignment- Parameters:
vert- vertical alignment
-
setHAlign
public void setHAlign(int horz)
Set horizontal alignment- Parameters:
horz- horizontal alignment
-
getVAlign
public int getVAlign()
Get vertical alignment- Returns:
- vertical alignment
-
getHAlign
public int getHAlign()
Get horizontal alignment- Returns:
- horizontal alignment
-
setLocationP
public void setLocationP(Point2D.Double loc)
Set location of logo
Property Change:location.- Parameters:
loc- logo location
-
getLocationP
public Point2D.Double getLocationP()
Get location of logo.- Returns:
- Logo location
-
draw
public void draw(org.freehep.graphics2d.VectorGraphics g)
Draw the Logo. If the imageURL was specified the image is retrieved using the URL and MediaTracker. The image is displayed after it is loaded.- Specified by:
drawin interfaceLayerChild- Parameters:
g- Graphics context
-
getBounds
public java.awt.Rectangle getBounds()
Get the bounding rectangle.- Specified by:
getBoundsin interfaceMoveable- Specified by:
getBoundsin interfaceSelectable- Returns:
- bounding rectangle
-
getLocation
public java.awt.Point getLocation()
Description copied from interface:MoveableGets the location in device coordinates.- Specified by:
getLocationin interfaceMoveable- Returns:
- location
-
setLocation
public void setLocation(java.awt.Point loc)
Description copied from interface:MoveableSets the location in device coordinates.- Specified by:
setLocationin interfaceMoveable
-
setBounds
public void setBounds(java.awt.Rectangle r)
Set the bounds of theLogo
-
setBounds
public void setBounds(int x, int y, int width, int height)Set the bounds of theLogo
Property Change:location.
-
toString
public java.lang.String toString()
Description copied from interface:LayerChildReturn a string that represents theLayerChild.- Specified by:
toStringin interfaceLayerChild- Overrides:
toStringin classjava.lang.Object- Returns:
- Stringified
LayerChildrepresentation.
-
isVisible
public boolean isVisible()
Description copied from interface:LayerChildCheck ifLayerChildis visible.- Specified by:
isVisiblein interfaceLayerChild- Returns:
- true if visible
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:LayerChildSet visibility for aLayerChild.- Specified by:
setVisiblein interfaceLayerChild- Parameters:
visible- visible if true
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface:MoveableAdd a new PropertyChangeListener. Properties will include "moved". Implementation of the following two methods will normally be via the PropertyChangeSupport class.- Specified by:
addPropertyChangeListenerin interfaceMoveable
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface:MoveableRemove a listener.- Specified by:
removePropertyChangeListenerin interfaceMoveable
-
-
DMelt 3.0 © DataMelt by jWork.ORG