|
SGT Home | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.noaa.pmel.sgt.SGLabel
Draws text on a layer object. SGLabel uses the drawString() method of the Graphics class. SGLabel allows the user to align the text both vertically (TOP, MIDDLE, and BOTTOM) and horizontally (LEFT, MIDDLE, and RIGHT). The font, color, and height (in user coordinates) can also be specified. The SGLabel can also be drawn either HORIZONTAL or VERTICAL.
Graphics
Field Summary | |
static int |
ANGLE
Orient label at an angle |
static int |
BOTTOM
Align bottom of label |
static int |
CENTER
Align center of label |
static int |
HORIZONTAL
Orient label horizontal |
static int |
LEFT
Align left of label |
static int |
MIDDLE
Align middle of label |
static int |
RIGHT
Align right of label |
static int |
TOP
Align top of label |
static int |
VERTICAL
Orient label vertical |
Constructor Summary | |
SGLabel(java.lang.String id,
java.lang.String lbl,
double hgt,
Point2D.Double loc,
int valign,
int halign)
Long SGLabel constructor. |
|
SGLabel(java.lang.String id,
java.lang.String lbl,
Point2D.Double loc)
Quick SGLabel constructor. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a new PropertyChangeListener. |
LayerChild |
copy()
Create a copy of the LayerChild . |
void |
draw(java.awt.Graphics g)
Draw the LayerChild . |
double |
getAngle()
Get label drawing angle. |
java.awt.Rectangle |
getBounds()
Get the label bounds in device units. |
Rectangle2D.Double |
getBoundsP()
Get the label bounds in physical units. |
java.awt.Color |
getColor()
Get the color. |
java.awt.Font |
getFont()
Get the font. |
int |
getHAlign()
Get the horizontal alignment. |
int |
getHeight()
Get the label height in device coordinates. |
double |
getHeightP()
Get the label height in physical coordinates. |
java.lang.String |
getId()
Get the label identifier. |
Layer |
getLayer()
Get the layer. |
java.awt.Point |
getLocation()
Get the label position in device coordinates. |
Point2D.Double |
getLocationP()
Get the label reference location in physcial coordinates. |
int |
getOrientation()
Get the origentation. |
AbstractPane |
getPane()
Get AbstractPane of the LayerChild . |
float |
getStringHeight(java.awt.Graphics g)
Get the string height in device units. |
float |
getStringWidth(java.awt.Graphics g)
Get the string width in device units. |
java.lang.String |
getText()
Get the label text. |
int |
getVAlign()
Get the vertical alignment. |
boolean |
isMoveable()
Returns true if the current state is moveable |
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 text)
Used by sgt internally. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a listener. |
void |
setAlign(int vert,
int horz)
Set the vertical and horizontal alignment. |
void |
setAngle(double angle)
Draw label at arbitrary rotation. |
void |
setBounds(int x,
int y,
int width,
int height)
Set the label bounds in device units. |
void |
setBounds(java.awt.Rectangle r)
Set the label bounds in device units. |
void |
setColor(java.awt.Color color)
Set the color. |
void |
setFont(java.awt.Font fnt)
Set the font. |
void |
setHAlign(int horz)
Set the horizontal alignment. |
void |
setHeightP(double hgt)
Set the height of the label in physical coordinates. |
void |
setId(java.lang.String id)
Set the label identifier. |
void |
setLayer(Layer l)
Associate a Layer with the LayerChild . |
void |
setLocation(java.awt.Point loc)
Set the label reference location in pixel coordinates. |
void |
setLocationP(Point2D.Double loc)
Set the label reference location in physcial coordinates. |
void |
setMoveable(boolean moveable)
Set the moveable property. |
void |
setOrientation(int orient)
Set the orientation. |
void |
setSelectable(boolean select)
Set the Selectable property. |
void |
setSelected(boolean sel)
Sets the selected property. |
void |
setText(java.lang.String lbl)
Set the label text. |
void |
setVAlign(int vert)
Set the vertical alignment. |
void |
setVisible(boolean visible)
Set visibility for a LayerChild . |
java.lang.String |
toString()
Return a string that represents the LayerChild . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int TOP
public static final int MIDDLE
public static final int BOTTOM
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int HORIZONTAL
public static final int VERTICAL
public static final int ANGLE
Constructor Detail |
public SGLabel(java.lang.String id, java.lang.String lbl, Point2D.Double loc)
id
- Label identifierlbl
- String to be plotted.public SGLabel(java.lang.String id, java.lang.String lbl, double hgt, Point2D.Double loc, int valign, int halign)
id
- Label identifierlbl
- String to be plottedhgt
- String height in physical unitsloc
- Location to plot label in physical unitsvalign
- Vertical alignmenthalign
- Horizontal alignmentMethod Detail |
public LayerChild copy()
LayerChild
LayerChild
.copy
in interface LayerChild
gov.noaa.pmel.sgt.LayerChild
LayerChild
.public void draw(java.awt.Graphics g) throws LayerNotFoundException
LayerChild
LayerChild
.draw
in interface LayerChild
gov.noaa.pmel.sgt.LayerChild
g
- Graphics contextLayerNotFoundException
- No layer is associated with the LayerChild
.public void setSelected(boolean sel)
Selectable
setSelected
in interface Selectable
gov.noaa.pmel.sgt.Selectable
sel
- true if selected, false if not.public boolean isSelected()
Selectable
isSelected
in interface Selectable
gov.noaa.pmel.sgt.Selectable
public void setSelectable(boolean select)
Selectable
setSelectable
in interface Selectable
gov.noaa.pmel.sgt.Selectable
select
- if true object is selectablepublic boolean isSelectable()
Selectable
isSelectable
in interface Selectable
gov.noaa.pmel.sgt.Selectable
public void setColor(java.awt.Color color)
color
- The color of the label.Color
public java.awt.Color getColor()
public void setFont(java.awt.Font fnt)
fnt
- The Font to use to draw the label.Font
public java.awt.Font getFont()
public void setHeightP(double hgt)
hgt
- The label height.public double getHeightP()
public void setAlign(int vert, int horz)
vert
- The vertical alignment.horz
- The horizontal alignment.public void setHAlign(int horz)
horz
- The horizontal alignment.public int getHAlign()
public void setVAlign(int vert)
vert
- The vertical alignment.public int getVAlign()
public void setLocationP(Point2D.Double loc)
location
.loc
- physical location of labelpublic Point2D.Double getLocationP()
public void setOrientation(int orient)
orient
- The orientation.public int getOrientation()
public void setAngle(double angle)
public double getAngle()
public void setLayer(Layer l)
LayerChild
Layer
with the LayerChild
.setLayer
in interface LayerChild
gov.noaa.pmel.sgt.LayerChild
l
- Parent layer.public Layer getLayer()
getLayer
in interface LayerChild
public AbstractPane getPane()
LayerChild
AbstractPane
of the LayerChild
.getPane
in interface LayerChild
public void modified(java.lang.String text)
LayerChild
modified
in interface LayerChild
public java.lang.String getText()
public void setText(java.lang.String lbl)
lbl
- the label textpublic java.lang.String getId()
getId
in interface LayerChild
public void setId(java.lang.String id)
setId
in interface LayerChild
id
- the label identifierpublic int getHeight()
public java.awt.Point getLocation()
getLocation
in interface Moveable
public void setLocation(java.awt.Point loc)
location
.setLocation
in interface Moveable
loc
- physical location of labelpublic Rectangle2D.Double getBoundsP()
public java.awt.Rectangle getBounds()
getBounds
in interface Selectable
public void setBounds(java.awt.Rectangle r)
public void setBounds(int x, int y, int width, int height)
public java.lang.String toString()
LayerChild
LayerChild
.toString
in interface LayerChild
toString
in class java.lang.Object
gov.noaa.pmel.sgt.LayerChild
LayerChild
representation.public boolean isVisible()
LayerChild
LayerChild
is visible.isVisible
in interface LayerChild
gov.noaa.pmel.sgt.LayerChild
public void setVisible(boolean visible)
LayerChild
LayerChild
.setVisible
in interface LayerChild
gov.noaa.pmel.sgt.LayerChild
visible
- visible if truepublic boolean isMoveable()
Moveable
isMoveable
in interface Moveable
gov.noaa.pmel.sgt.Moveable
public void setMoveable(boolean moveable)
Moveable
setMoveable
in interface Moveable
gov.noaa.pmel.sgt.Moveable
select
- if true object is moveablepublic float getStringWidth(java.awt.Graphics g)
public float getStringHeight(java.awt.Graphics g)
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Moveable
addPropertyChangeListener
in interface Moveable
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Moveable
removePropertyChangeListener
in interface Moveable
|
SGT Home | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |