fr.esrf.tangoatk.widget.util.jdraw
Class JDLabel

java.lang.Object
  extended by fr.esrf.tangoatk.widget.util.jdraw.JDObject
      extended by fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
          extended by fr.esrf.tangoatk.widget.util.jdraw.JDLabel

public class JDLabel
extends JDRectangular

JDraw Label graphic object.

Here is an example of few JDLabel:

JDLabel examples


Field Summary
static int BOTTOM_TO_TOP
          Text orientation
static int CENTER_ALIGNMENT
          Text is centered
static int DOWN_ALIGNMENT
          Down justification for text (V alignement)
static int LEFT_ALIGNMENT
          Left justification for text (H alignement)
static int LEFT_TO_RIGHT
          Text orientation
static int RIGHT_ALIGNMENT
          Right justification for text (H alignement)
static int RIGHT_TO_LEFT
          Text orientation
static int TOP_TO_BOTTOM
          Text orientation
static int UP_ALIGNMENT
          Up justification for text (V alignement)
 
Fields inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
FILL_STYLE_DOT_PATTERN_1, FILL_STYLE_DOT_PATTERN_2, FILL_STYLE_DOT_PATTERN_3, FILL_STYLE_GRADIENT, FILL_STYLE_LARGE_CROSS_HATCH, FILL_STYLE_LARGE_LEFT_HATCH, FILL_STYLE_LARGE_RIGHT_HATCH, FILL_STYLE_NONE, FILL_STYLE_SMALL_CROSS_HATCH, FILL_STYLE_SMALL_LEFT_HATCH, FILL_STYLE_SMALL_RIGHT_HATCH, FILL_STYLE_SOLID, LINE_STYLE_DASH, LINE_STYLE_DASH_DOT, LINE_STYLE_DOT, LINE_STYLE_LONG_DASH, LINE_STYLE_SOLID, VALUE_CHANGE_ON_XDRAG_LEFT, VALUE_CHANGE_ON_XDRAG_RIGHT, VALUE_CHANGE_ON_YDRAG_BOTTOM, VALUE_CHANGE_ON_YDRAG_TOP, VALUE_INC_ON_CLICK, VALUE_INC_ON_PRESSRELEASE
 
Constructor Summary
JDLabel(java.lang.String objectName, java.lang.String text, int x, int y)
          Construcxt a label.
 
Method Summary
 JDObject copy(int x, int y)
          Returns a copy of this object at the specified location.
 java.awt.Font getFont()
          Returns the current font of this label.
 int getHorizontalAlignment()
          Returns the current horizontal text alignement.
 int getOrientation()
          Gets the current text orientation.
 java.lang.String getText()
          Returns the current label text.
 void paint(JDrawEditor parent, java.awt.Graphics g)
          Paints this object.
 void restoreTransform()
          Restore original shape previously backuped by saveTransform
 void rotate90(double x, double y)
          Rotate the object by 90deg.
 void saveTransform()
          Backup the shape.
 void setFont(java.awt.Font f)
          Sets the Font of this label.
 void setFont(java.awt.Font f, boolean resize)
          Sets the font of this label and resize it if needed and specified.
 void setHorizontalAlignment(int a)
          Sets the horizontal alignement of this label.
 void setOrientation(int a)
          Sets the text orientation.
 void setText(java.lang.String s)
          Sets the text of this label.
 void setText(java.lang.String s, boolean resize)
          Sets the text of this label and resize label if desried.
 int setVerticalAlignment()
          Returns the current vetical text alignement.
 void setVerticalAlignment(int a)
          Sets the vertical alignement of this label.
 
Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
moveSummit
 
Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
addExtension, addMouseListener, addValueListener, centerOrigin, clearMouseListener, clearValueListener, getBackground, getBackgroundMapper, getBoundRect, getExtendedParam, getExtendedParam, getExtendedParamDesc, getExtendedParamIndex, getExtendedParamName, getExtendedParamNumber, getFillStyle, getForeground, getForegroundMapper, getHTranslationMapper, getInitValue, getInvertShadowMapper, getLineStyle, getLineWidth, getMaxValue, getMinValue, getName, getObjectsByName, getOrigin, getShadowWidth, getSummit, getSummitNumber, getValue, getValueChangeMode, getVisibilityMapper, getVTranslationMapper, hasBackgroundMapper, hasExtendedParam, hasForegroundMapper, hasHTranslationMapper, hasInverseShadow, hasInvertShadowMapper, hasShadow, hasVisibilityMapper, hasVTranslationMapper, isAntiAliased, isFixedExtendedParam, isInsideObject, isInteractive, isProgrammed, isVisible, moveSummitH, moveSummitV, preRefresh, refresh, removeExtension, removeMouseListener, removeValueListener, scale, scaleTranslate, setAntiAlias, setBackground, setBackgroundMapper, setExtendedParam, setExtendedParam, setExtensionList, setFillStyle, setForeground, setForegroundMapper, setGradientFillParam, setHTranslationMapper, setInitValue, setInteractive, setInverseShadow, setInvertShadowMapper, setLineStyle, setLineWidth, setMaxValue, setMinValue, setName, setOrigin, setShadow, setShadowWidth, setValue, setValueChangeMode, setVisibilityMapper, setVisible, setVTranslationMapper, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTER_ALIGNMENT

public static final int CENTER_ALIGNMENT
Text is centered

See Also:
Constant Field Values

LEFT_ALIGNMENT

public static final int LEFT_ALIGNMENT
Left justification for text (H alignement)

See Also:
Constant Field Values

RIGHT_ALIGNMENT

public static final int RIGHT_ALIGNMENT
Right justification for text (H alignement)

See Also:
Constant Field Values

UP_ALIGNMENT

public static final int UP_ALIGNMENT
Up justification for text (V alignement)

See Also:
Constant Field Values

DOWN_ALIGNMENT

public static final int DOWN_ALIGNMENT
Down justification for text (V alignement)

See Also:
Constant Field Values

LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT
Text orientation

See Also:
Constant Field Values

BOTTOM_TO_TOP

public static final int BOTTOM_TO_TOP
Text orientation

See Also:
Constant Field Values

RIGHT_TO_LEFT

public static final int RIGHT_TO_LEFT
Text orientation

See Also:
Constant Field Values

TOP_TO_BOTTOM

public static final int TOP_TO_BOTTOM
Text orientation

See Also:
Constant Field Values
Constructor Detail

JDLabel

public JDLabel(java.lang.String objectName,
               java.lang.String text,
               int x,
               int y)
Construcxt a label.

Parameters:
objectName - Name of this label
text - Text
x - Up left corner x coordinate
y - Up left corner y coordinate
Method Detail

copy

public JDObject copy(int x,
                     int y)
Description copied from class: JDObject
Returns a copy of this object at the specified location.

Specified by:
copy in class JDObject
Parameters:
x - Horizontal position of the copied object (pixel)
y - Vertical Position of the copied object (pixel)
Returns:
The copy of this object.

paint

public void paint(JDrawEditor parent,
                  java.awt.Graphics g)
Description copied from class: JDObject
Paints this object.

Overrides:
paint in class JDRectangular
Parameters:
parent - JdrawEditor parent (Can be null except for JDSwingObject)
g - the specified Graphics window

rotate90

public void rotate90(double x,
                     double y)
Description copied from class: JDObject
Rotate the object by 90deg. A call to refresh() is needed after transformation.

Overrides:
rotate90 in class JDRectangular
Parameters:
x - Rotation center horizontal pos
y - Rotation center vertical pos
See Also:
JDObject.refresh()

restoreTransform

public void restoreTransform()
Description copied from class: JDObject
Restore original shape previously backuped by saveTransform

Overrides:
restoreTransform in class JDObject
See Also:
JDObject.saveTransform()

saveTransform

public void saveTransform()
Description copied from class: JDObject
Backup the shape. This can be usefull when making scaling animation, after multiple scale the rounding may result in deformed shape. To avoid this you can use saveTransform() and restoreTransform(). Note: This is done once when JDrawEditor.loadFile() is called().

Overrides:
saveTransform in class JDObject
See Also:
JDObject.restoreTransform()

setFont

public void setFont(java.awt.Font f)
Sets the Font of this label.

Parameters:
f - Font

setFont

public void setFont(java.awt.Font f,
                    boolean resize)
Sets the font of this label and resize it if needed and specified.

Parameters:
f - Font
resize - true to resize label when text is out of bounds.

getFont

public java.awt.Font getFont()
Returns the current font of this label.


setHorizontalAlignment

public void setHorizontalAlignment(int a)
Sets the horizontal alignement of this label.

Parameters:
a - Alignement value
See Also:
CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT

getHorizontalAlignment

public int getHorizontalAlignment()
Returns the current horizontal text alignement.

See Also:
setHorizontalAlignment(int)

setVerticalAlignment

public void setVerticalAlignment(int a)
Sets the vertical alignement of this label.

Parameters:
a - Alignement value
See Also:
CENTER_ALIGNMENT, UP_ALIGNMENT, DOWN_ALIGNMENT

setVerticalAlignment

public int setVerticalAlignment()
Returns the current vetical text alignement.

See Also:
setHorizontalAlignment(int)

setOrientation

public void setOrientation(int a)
Sets the text orientation.

Parameters:
a - Orientation
See Also:
LEFT_TO_RIGHT, BOTTOM_TO_TOP, RIGHT_TO_LEFT, TOP_TO_BOTTOM

getOrientation

public int getOrientation()
Gets the current text orientation.

See Also:
setOrientation(int)

setText

public void setText(java.lang.String s)
Sets the text of this label.

Parameters:
s - Text value

setText

public void setText(java.lang.String s,
                    boolean resize)
Sets the text of this label and resize label if desried.

Parameters:
s - Text value
resize - true to resize label when text is out of bounds.

getText

public java.lang.String getText()
Returns the current label text.