org.xith3d.ui.hud.widgets
Class Label

java.lang.Object
  extended by org.xith3d.ui.hud.base.WidgetBase
      extended by org.xith3d.ui.hud.base.RectangularWidget
          extended by org.xith3d.ui.hud.widgets.Label
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.types.twodee.Positioned2f, org.openmali.types.twodee.Positioned2fRO, org.openmali.types.twodee.Sized2f, org.openmali.types.twodee.Sized2fRO, AdvancedTextWidget, BackgroundSettable, BackgroundSettableWidget, PaddingSettable, TextWidget, Widget
Direct Known Subclasses:
DefaultContextMenuItem, DynamicLabel, TextField

public class Label
extends RectangularWidget
implements AdvancedTextWidget, PaddingSettable, org.jagatoo.datatypes.Enableable

A Label displays text content, that won't change too often. Use it in any case, when you don't plan to change the Label's text each few frames. For highly dynmaic text content you should consider to use DynamicLabel.

See Also:
DynamicLabel, NumberLabel

Nested Class Summary
static class Label.Description
          This class is used to describe a (set of) Label Widget(s).
 
Nested classes/interfaces inherited from interface org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
protected  boolean autoSize
           
 
Fields inherited from class org.xith3d.ui.hud.base.WidgetBase
containerListeners, transformGroup, translation, Z_INDEX_UNIT, Z_INDEX_UNIT_ASSEMBLER
 
Constructor Summary
Label(float width, float height)
          Creates a new Label with the given width and height and no text initially.
Label(float width, float height, int zIndex)
          Creates a new Label with the given width, height and z-index and no text initially.
Label(float width, float height, int zIndex, java.lang.String text)
          Creates a new Label with the given width and height and no text initially.
Label(float width, float height, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
Label(float width, float height, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
Label(float width, float height, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width, height and z-index.
Label(float width, float height, int zIndex, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
Label(float width, float height, int zIndex, java.lang.String text, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text)
          Creates a new Label with the given width and height and no text initially.
Label(float width, float height, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, java.awt.Font font)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, java.awt.Font font, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(float width, float height, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
Label(float width, float height, java.lang.String text, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size)
          Creates a new Label with the given width and height and no text initially.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex)
          Creates a new Label with the given width, height and z-index and no text initially.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width, height and z-index.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
Label(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text)
          Creates a new Label with the given width and height and no text initially.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
Label(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
 
Method Summary
protected  void fixTranslation(org.openmali.vecmath2.Tuple2f offset)
           
 TextAlignment getAlignment()
           
 Texture getBackground()
          
 org.openmali.vecmath2.Colorf getBackgroundColor()
          
 float getBackgroundTileHeight()
          
 org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()
          
 float getBackgroundTileWidth()
          
 GroupNode getContentGroup()
           
protected  java.lang.String getDisplayedText()
           
 java.awt.Font getFont()
          
protected  java.awt.Font getFont(boolean disabled)
           
 org.openmali.vecmath2.Colorf getFontColor()
          
protected  org.openmali.vecmath2.Colorf getFontColor(boolean disabled)
           
 org.openmali.vecmath2.Colorf getFontColorDisabled()
          
 java.awt.Font getFontDisabled()
          
 org.openmali.types.twodee.Dim2f getMinimalSize(org.openmali.types.twodee.Dim2f buffer)
          Calculates the minimum Size needed to contain the whole caption.
 float getPaddingBottom()
          
 float getPaddingLeft()
          
 float getPaddingRight()
          
 float getPaddingTop()
          
 java.lang.String getText()
          
 Rectangle getTextRectangle()
           
 float getTransparency()
          
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isAutoSizeEnabled()
           
 boolean isEnabled()
          
 void setAlignment(TextAlignment alignment)
          Sets the horizontal and vertical alignment of the text
 void setAutoSizeEnabled(boolean enabled)
          Enables or disables auto-sizing.
 void setBackground(org.openmali.vecmath2.Colorf color)
          Sets the background color of the Widget.
 void setBackground(java.lang.String texture)
          Sets the background Texture of the Widget.
 void setBackground(Texture texture)
          Sets the background texture of the Widget.
 void setBackgroundTileSize(float tileWidth, float tileHeight)
          Sets the background tile size.
 void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
          Sets the background tile size.
 void setContainer(WidgetContainer container)
          Sets this Widget's container
 void setEnabled(boolean enabled)
          
protected  void setEnabledImpl(boolean enabled)
           
 void setFont(java.awt.Font font)
          Sets the new Font to be used
 void setFontColor(org.openmali.vecmath2.Colorf color)
          Sets the new color to be used
 void setFontColorDisabled(org.openmali.vecmath2.Colorf color)
          
 void setFontDisabled(java.awt.Font font)
          
 void setMinimalSize()
          Resizes this Label to the minimum Size needed to contain the whole caption.
 boolean setPadding(float padding)
          Sets padding for this PaddingSettable Widget.
 boolean setPadding(float paddingBottom, float paddingRight, float paddingTop, float paddingLeft)
          Sets padding for this PaddingSettable Widget.
 boolean setSize(float width, float height, boolean forced)
          
 void setText(java.lang.String text)
          Sets the new text to be displayed
 void setTransparency(float transparency)
          Sets the whole Widget's Transparency.
 java.lang.String toString()
          
protected  void updateText()
           
protected  void updateTranslation()
          Effectively changes the translation of this Widget (location and z-index)
 
Methods inherited from class org.xith3d.ui.hud.base.RectangularWidget
getPickHeight, getPickSGZPosition, getPickWidth, pick
 
Methods inherited from class org.xith3d.ui.hud.base.WidgetBase
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidgetAssembler, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isInitialized, isInitializing, isPickable, isVisible, onAddedToContainer, onAddedToHUD, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, onMouseWheelMoved, onRemovedFromContainer, pickWidgetAssembler, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContextMenu, setCursor, setDraggable, setFocussable, setHeight, setLocation, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setUserObject, setVisible, setWidth, setZIndex, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xith3d.ui.hud.base.Widget
addContainerListener, addFocusListener, addInputListener, addLocationListener, addSizeListener, addVisibilityListener, detach, detach, getAspect, getAssembly, getCachedToolTipWidget, getContainer, getContextMenu, getCursor, getHeight, getHUD, getInheritedCursor, getLeft, getLocation, getName, getSGNode, getSGZPosition, getSize, getToolTip, getTop, getUserObject, getWidth, getZIndex, hasFocus, hasFocus, hasToolTip, isClickable, isDraggable, isFocussable, isPickable, isVisible, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetached, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseLeft, onMouseMoved, onMouseStopped, onMouseUnbound, onMouseWheelMoved, pick, removeContainerListener, removeFocusListener, removeInputListener, removeLocationListener, removeSizeListener, removeVisibilityListener, requestFocus, setAssembly, setCachedToolTipWidget, setClickable, setContextMenu, setCursor, setDraggable, setFocussable, setLocation, setLocation, setName, setPickable, setSize, setSize, setSize, setToolTip, setUserObject, setVisible, setZIndex, update
 
Methods inherited from interface org.openmali.types.twodee.Sized2f
setHeight, setWidth
 

Field Detail

autoSize

protected boolean autoSize
Constructor Detail

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             Label.Description labelDesc)
Creates a new Label with the given width, height and z-index.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
labelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

Label

public Label(float width,
             float height,
             java.lang.String text,
             Label.Description labelDesc)
Creates a new Label with the given width, height and z-index.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
labelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             Label.Description labelDesc)
Creates a new Label with the given width, height and z-index.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
labelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             Label.Description labelDesc)
Creates a new Label with the given width, height and z-index.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
labelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width, height and z-index.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width, height and z-index.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             java.lang.String text,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used

Label

public Label(float width,
             float height,
             java.lang.String text,
             java.awt.Font font,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
color - the color to be used

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
color - the color to be used

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget
color - the color to be used

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
color - the color to be used

Label

public Label(float width,
             float height,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
color - the color to be used

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             java.awt.Font font)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text

Label

public Label(float width,
             float height,
             java.lang.String text,
             java.awt.Font font)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text,
             java.awt.Font font,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
alignment - the horizontal and vertical alignment

Label

public Label(float width,
             float height,
             java.lang.String text,
             java.awt.Font font,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font - the Font to be used for the text
alignment - the horizontal and vertical alignment

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             int zIndex)
Creates a new Label with the given width, height and z-index and no text initially.

Parameters:
size - the new size of this Widget
zIndex - the z-index of this Widget

Label

public Label(float width,
             float height,
             int zIndex)
Creates a new Label with the given width, height and z-index and no text initially.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget

Label

public Label(org.openmali.types.twodee.Sized2fRO size)
Creates a new Label with the given width and height and no text initially.

Parameters:
size - the new size of this Widget

Label

public Label(float width,
             float height)
Creates a new Label with the given width and height and no text initially.

Parameters:
width - the new width of this Widget
height - the new height of this Widget

Label

public Label(org.openmali.types.twodee.Sized2fRO size,
             java.lang.String text)
Creates a new Label with the given width and height and no text initially.

Parameters:
size - the new size of this Widget
text - the text to display in this TextWidget

Label

public Label(float width,
             float height,
             int zIndex,
             java.lang.String text)
Creates a new Label with the given width and height and no text initially.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
zIndex - the z-index of this Widget
text - the text to display in this TextWidget

Label

public Label(float width,
             float height,
             java.lang.String text)
Creates a new Label with the given width and height and no text initially.

Parameters:
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
Method Detail

getContentGroup

public GroupNode getContentGroup()
Returns:
the TransformGroup to put the Text2DNode or whatever in

setTransparency

public void setTransparency(float transparency)
Sets the whole Widget's Transparency.

Specified by:
setTransparency in interface Widget
Overrides:
setTransparency in class WidgetBase

getTransparency

public float getTransparency()

Specified by:
getTransparency in interface Widget
Returns:
the whole Widget's Transparency.

setBackground

public void setBackground(org.openmali.vecmath2.Colorf color)
Sets the background color of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
color - the color to use

setBackground

public void setBackground(java.lang.String texture)
Sets the background Texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

setBackground

public void setBackground(Texture texture)
Sets the background texture of the Widget.

Specified by:
setBackground in interface BackgroundSettable
Parameters:
texture - the texture resource to use

getBackground

public Texture getBackground()

Specified by:
getBackground in interface BackgroundSettable
Returns:
the background Texture of the WidgetContainer.

getBackgroundColor

public org.openmali.vecmath2.Colorf getBackgroundColor()

Specified by:
getBackgroundColor in interface BackgroundSettable
Returns:
the background color of the Widget.

setBackgroundTileSize

public void setBackgroundTileSize(float tileWidth,
                                  float tileHeight)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileWidth - the tile width (or negative for no tiling of width)
tileHeight - the tile height (or negative for no tiling of height)

setBackgroundTileSize

public void setBackgroundTileSize(org.openmali.types.twodee.Sized2fRO tileSize)
Sets the background tile size.
Use any negative value for no tiling.

Specified by:
setBackgroundTileSize in interface BackgroundSettable
Parameters:
tileSize - the tile size (or null for no tiling)

getBackgroundTileSize

public org.openmali.types.twodee.Sized2fRO getBackgroundTileSize()

Specified by:
getBackgroundTileSize in interface BackgroundSettable
Returns:
the background tile size (or null for no tiling)

getBackgroundTileWidth

public float getBackgroundTileWidth()

Specified by:
getBackgroundTileWidth in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

getBackgroundTileHeight

public float getBackgroundTileHeight()

Specified by:
getBackgroundTileHeight in interface BackgroundSettable
Returns:
the background tile width (or negative for no tiling)

setPadding

public boolean setPadding(float paddingBottom,
                          float paddingRight,
                          float paddingTop,
                          float paddingLeft)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Returns:
true, if the padding actually has changed

setPadding

public final boolean setPadding(float padding)
Sets padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

Specified by:
setPadding in interface PaddingSettable
Parameters:
padding - padding for bottom, right, top and left
Returns:
true, if the padding actually has changed

getPaddingBottom

public float getPaddingBottom()

Specified by:
getPaddingBottom in interface PaddingSettable
Returns:
bottom-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingRight

public float getPaddingRight()

Specified by:
getPaddingRight in interface PaddingSettable
Returns:
right-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingTop

public float getPaddingTop()

Specified by:
getPaddingTop in interface PaddingSettable
Returns:
top-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

getPaddingLeft

public float getPaddingLeft()

Specified by:
getPaddingLeft in interface PaddingSettable
Returns:
left-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

setAutoSizeEnabled

public void setAutoSizeEnabled(boolean enabled)
Enables or disables auto-sizing.
If enabled, the Label's size will always be the minimal size to wrap the whole text content.

Parameters:
enabled -

isAutoSizeEnabled

public boolean isAutoSizeEnabled()
Returns:
if auto-sizing is enabled.
If enabled, the Label's size will always be the minimal size to wrap the whole text content.

getTextRectangle

public Rectangle getTextRectangle()
Returns:
the untilized Quad to display the text

getDisplayedText

protected java.lang.String getDisplayedText()
Returns:
the text, that is actually displayed on the Label.

updateText

protected void updateText()

setText

public void setText(java.lang.String text)
Sets the new text to be displayed

Specified by:
setText in interface TextWidget
Parameters:
text - the new Text

getText

public java.lang.String getText()

Specified by:
getText in interface TextWidget
Returns:
the text that is displayed

setAlignment

public void setAlignment(TextAlignment alignment)
Sets the horizontal and vertical alignment of the text

Specified by:
setAlignment in interface TextWidget

getAlignment

public TextAlignment getAlignment()
Specified by:
getAlignment in interface TextWidget
Returns:
the horizontal and vertical alignment of the text

setFont

public void setFont(java.awt.Font font)
Sets the new Font to be used

Specified by:
setFont in interface TextWidget
Parameters:
font - the new Font

getFont

public final java.awt.Font getFont()

Specified by:
getFont in interface TextWidget
Returns:
the used Font

setFontDisabled

public void setFontDisabled(java.awt.Font font)


getFontDisabled

public final java.awt.Font getFontDisabled()


getFont

protected java.awt.Font getFont(boolean disabled)

setFontColor

public void setFontColor(org.openmali.vecmath2.Colorf color)
Sets the new color to be used

Specified by:
setFontColor in interface TextWidget
Parameters:
color - the new color

getFontColor

public final org.openmali.vecmath2.Colorf getFontColor()

Specified by:
getFontColor in interface TextWidget
Returns:
the used color

setFontColorDisabled

public void setFontColorDisabled(org.openmali.vecmath2.Colorf color)


getFontColorDisabled

public final org.openmali.vecmath2.Colorf getFontColorDisabled()


getFontColor

protected org.openmali.vecmath2.Colorf getFontColor(boolean disabled)

setEnabledImpl

protected void setEnabledImpl(boolean enabled)

setEnabled

public final void setEnabled(boolean enabled)

Specified by:
setEnabled in interface org.jagatoo.datatypes.Enableable

isEnabled

public final boolean isEnabled()

Specified by:
isEnabled in interface org.jagatoo.datatypes.Enableable

setSize

public boolean setSize(float width,
                       float height,
                       boolean forced)

Overrides:
setSize in class WidgetBase

getMinimalSize

public org.openmali.types.twodee.Dim2f getMinimalSize(org.openmali.types.twodee.Dim2f buffer)
Calculates the minimum Size needed to contain the whole caption.


setMinimalSize

public void setMinimalSize()
Resizes this Label to the minimum Size needed to contain the whole caption.


fixTranslation

protected void fixTranslation(org.openmali.vecmath2.Tuple2f offset)

updateTranslation

protected void updateTranslation()
Effectively changes the translation of this Widget (location and z-index)

Overrides:
updateTranslation in class WidgetBase

init

protected void init()
This method is called when the WidgetContainer is set.

Specified by:
init in class WidgetBase

setContainer

public void setContainer(WidgetContainer container)
Sets this Widget's container

Specified by:
setContainer in interface Widget
Overrides:
setContainer in class WidgetBase
Parameters:
container - the new Container

toString

public java.lang.String toString()

Overrides:
toString in class WidgetBase