org.xith3d.ui.hud.widgets
Class Label

java.lang.Object
  extended by org.xith3d.ui.hud.base.Widget
      extended by org.xith3d.ui.hud.base.BackgroundSettableWidget
          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, AutoSizable, PaddingSettable, TextWidget
Direct Known Subclasses:
DefaultContextMenuItem, FPSCounter, TextField, WindowHeaderWidget

public class Label
extends BackgroundSettableWidget
implements TextWidget, PaddingSettable, org.jagatoo.datatypes.Enableable, AutoSizable

A Label displays text content. The new implementation is very highly optimized for both static and dynamic text.


Nested Class Summary
static class Label.Description
          This class is used to describe a (set of) Label Widget(s).
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
BackgroundSettableWidget.BackgroundSettableDescriptionBase
 
Nested classes/interfaces inherited from class org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
protected static boolean DEFAULT_HEAVYWEIGHT
           
 
Fields inherited from class org.xith3d.ui.hud.base.Widget
transformHeight_Pixels2HUD, transformWidth_Pixels2HUD
 
Constructor Summary
protected Label(boolean isHeavyWeight, boolean hasWidgetAssembler, float width, float height, java.lang.String text, HUDFont font_enabled, HUDFont font_disabled, org.openmali.vecmath2.Colorf fontColor_enabled, org.openmali.vecmath2.Colorf fontColor_disabled, TextAlignment alignment, org.openmali.vecmath2.Colorf backgroundColor, Texture2D backgroundTexture)
          Creates a new Label with the given width, height and z-index.
protected Label(boolean isHeavyWeight, boolean hasWidgetAssembler, float width, float height, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, float width, float height)
          Creates a new Label with the given width and height and no text initially.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text)
          Creates a new Label with the given width and height and no text initially.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, 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(boolean isHeavyWeight, float width, float height, java.lang.String text, HUDFont font)
          Creates a new Label with the given width and height and a z-index of 0.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, HUDFont font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, HUDFont font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, HUDFont font_enabled, HUDFont font_disabled, org.openmali.vecmath2.Colorf fontColor_enabled, org.openmali.vecmath2.Colorf fontColor_disabled, TextAlignment alignment, org.openmali.vecmath2.Colorf backgroundColor, Texture2D backgroundTexture)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, HUDFont font, TextAlignment alignment)
          Creates a new Label with the given width and height and a z-index of 0.
  Label(boolean isHeavyWeight, float width, float height, java.lang.String text, Label.Description labelDesc)
          Creates a new Label with the given width, height and z-index.
  Label(boolean isHeavyWeight, 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(float width, float height)
          Creates a new Label with the given width and height and no text initially.
  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, height and z-index.
  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, HUDFont 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, HUDFont font, org.openmali.vecmath2.Colorf color)
          Creates a new Label with the given width, height and z-index.
  Label(float width, float height, java.lang.String text, HUDFont 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, HUDFont 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.
 
Method Summary
protected  void drawIcon(Texture2D icon, Texture2DCanvas texCanvas, int x, int y)
           
protected  void drawText(MultilineText multiLineText, Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height)
          Draws the text on the Label.
protected  void drawWidget(Texture2DCanvas texCanvas, int offsetX, int offsetY, int width, int height, boolean drawsSelf)
           
 TextAlignment getAlignment()
           
protected  java.lang.String getDisplayedText()
           
 HUDFont getFont()
          
protected  HUDFont getFont(boolean disabled)
           
 org.openmali.vecmath2.Colorf getFontColor()
          
protected  org.openmali.vecmath2.Colorf getFontColor(boolean disabled)
           
 org.openmali.vecmath2.Colorf getFontColorDisabled()
          
 HUDFont getFontDisabled()
          
 Texture2D getIcon()
          Gets the icon of this Label.
 int getIconGap()
          Gets the gap between the icon and the text.
 float getMinimalHeight()
          Gets the Label's minimum height.
<Dim2f_ extends org.openmali.types.twodee.Dim2f>
Dim2f_
getMinimalSize(Dim2f_ buffer)
          Calculates the minimum Size needed to contain the whole caption.
 float getMinimalWidth()
          Gets the Label's minimum width.
 int getPaddingBottom()
          
 int getPaddingLeft()
          
 int getPaddingRight()
          
 int getPaddingTop()
          
 java.lang.String getText()
          
 int getTextOffsetX()
           
 int getTextOffsetY()
           
protected  void init()
          This method is called when the WidgetContainer is set.
protected  void initSize()
          
 boolean isAutoSizeEnabled()
           
 boolean isEnabled()
          
protected  void onAttachedToHUD(HUD hud)
          This event is fired, when this Widget is added to the HUD live Widget hierarchy.
protected  void onSizeChanged(float oldWidth, float oldHeight, float newWidth, float newHeight)
          
protected  void prepareText(MultilineText multiLineText, Texture2DCanvas texCanvas, int width, int height)
           
 void setAlignment(TextAlignment alignment)
          Sets the horizontal and vertical alignment of the text
 void setAutoSizeEnabled(boolean enabled)
          Enables or disables auto-sizing.
 void setEnabled(boolean enabled)
          
protected  void setEnabledImpl(boolean enabled)
           
 void setFont(HUDFont 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(HUDFont font)
          
 void setIcon(java.lang.String icon)
          Sets the icon for this Label.
 void setIcon(Texture2D icon)
          Sets the icon for this Label.
 void setIconGap(int gap)
          Sets the gap between the icon and the text.
 void setMinimalSize()
          Resizes this Label to the minimum Size needed to contain the whole caption.
 boolean setPadding(int padding)
          Sets padding for this PaddingSettable Widget.
 boolean setPadding(int paddingBottom, int paddingRight, int paddingTop, int paddingLeft)
          Sets padding for this PaddingSettable Widget.
 void setText(float value)
          Sets the text from a float.
 void setText(java.lang.String text)
          Sets the new text to be displayed
 void setText(java.lang.String prefix, float value, char decimalSep, int decPlaces, java.lang.String postfix)
          Sets the text from a float.
 void setTextOffset(int textOffsetX, int textOffsetY)
           
protected  void updateText()
           
 
Methods inherited from class org.xith3d.ui.hud.base.BackgroundSettableWidget
drawBackground, getBackgroundColor, getBackgroundTexture, getBackgroundTileMode, setBackground, setBackground, setBackground, setBackgroundColor, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTexture, setBackgroundTileMode, setNoBackground
 
Methods inherited from class org.xith3d.ui.hud.base.Widget
addContainerListener, addControllerListener, addFocusListener, addInputListener, addKeyboardListener, addLocationListener, addMouseListener, addSizeListener, addVisibilityListener, bindToGlobalMouseMovement, blocksFocusMoveDeviceComponent, calculateTransformHeight_Pixels2HUD, calculateTransformWidth_Pixels2HUD, compareAbsZIndex, createShape, detach, drawAndUpdateWidget, drawBorder, drawWidgetAfterWidgetAssembler, drawWidgetContents, getAbsoluteLocationOnHUD_, getAspect, getAssembly, getBorder, getContainer, getContentAspect, getContentHeight, getContentHeightPX, getContentLeftPX, getContentOffset, getContentTopPX, getContentWidth, getContentWidthPX, getContextMenu, getCursor, getEqualHeight_, getEqualWidth_, getForcedRedrawFrequency, getHeight, getHeightPX, getHUD, getLeft, getLevel, getLocation, getLocation, getLocationHUD2Pixels_, getLocationHUD2SG_, getLocationPixels2HUD_, getLocationSG2HUD_, getMaxRedrawFrequency, getMinHeight, getMinWidth, getName, getParentWindow, getPickHeight, getPickWidth, getRelLocationHUD2Pixels_, getRootHostWidget, getShape, getSize, getSizeHUD2Pixels_, getSizeHUD2SG_, getSizeOfPixels_, getSizePixels2HUD_, getSizeSG2HUD_, getToolTip, getTop, getTransparency, getUserObject, getWidgetAssembler, getWidth, getWidthPX, getZIndex, hasDropShadow, hasFocus, hasFocus, hasToolTip, isAHostedWidgetDirty, isClickable, isDraggable, isFocussable, isHeavyWeight, isHovered, isInitialized, isInitializing, isPickable, isThisWidgetDirty, isVisible, notifyOnDragStopped, onAttachedToContainer, onControllerAxisChanged, onControllerButtonPressed, onControllerButtonReleased, onDetachedFromContainer, onDetachedFromHUD, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, onKeyReleased, onKeyTyped, onLocationChanged, onMouseButtonPressed, onMouseButtonReleased, onMouseEntered, onMouseExited, onMouseMoved, onMouseStopped, onMouseWheelMoved, onVisibilityChanged, pick, pickConditionsMatch, removeContainerListener, removeControllerListener, removeFocusListener, removeInputListener, removeKeyboardListener, removeLocationListener, removeMouseListener, removeSizeListener, removeVisibilityListener, requestFocus, resetWidgetDirty, setBorder, setBorder, setClickable, setContentClipRect, setContextMenu, setCursor, setDraggable, setFocussable, setForcedRedrawFrequency, setHasDropShadow, setHeight, setHostedWidgetDirty, setHostTextureDirty, setHostTextureDirty, setHostWidget, setLocation, setLocation, setLocation, setMaxRedrawFrequency, setName, setPickable, setSize, setSize, setSize, setSize, setTextureDirty, setTextureDirty, setToolTip, setTransparency, setTransparency, setUserObject, setVisible, setWidgetDirty, setWidth, setZIndex, startDragging, toString, update, updateAbsZIndex, updateSizeFactors, updateTranslation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HEAVYWEIGHT

protected static final boolean DEFAULT_HEAVYWEIGHT
See Also:
Constant Field Values
Constructor Detail

Label

protected Label(boolean isHeavyWeight,
                boolean hasWidgetAssembler,
                float width,
                float height,
                java.lang.String text,
                HUDFont font_enabled,
                HUDFont font_disabled,
                org.openmali.vecmath2.Colorf fontColor_enabled,
                org.openmali.vecmath2.Colorf fontColor_disabled,
                TextAlignment alignment,
                org.openmali.vecmath2.Colorf backgroundColor,
                Texture2D backgroundTexture)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
hasWidgetAssembler -
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font_enabled -
font_disabled -
fontColor_enabled -
fontColor_disabled -
alignment -
backgroundColor -
backgroundTexture -

Label

public Label(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             HUDFont font_enabled,
             HUDFont font_disabled,
             org.openmali.vecmath2.Colorf fontColor_enabled,
             org.openmali.vecmath2.Colorf fontColor_disabled,
             TextAlignment alignment,
             org.openmali.vecmath2.Colorf backgroundColor,
             Texture2D backgroundTexture)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
width - the new width of this Widget
height - the new height of this Widget
text - the text to display in this TextWidget
font_enabled -
font_disabled -
fontColor_enabled -
fontColor_disabled -
alignment -
backgroundColor -
backgroundTexture -

Label

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

Parameters:
isHeavyWeight -
hasWidgetAssembler -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             Label.Description labelDesc)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             HUDFont font,
             org.openmali.vecmath2.Colorf color,
             TextAlignment alignment)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             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:
isHeavyWeight -
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(boolean isHeavyWeight,
             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:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             HUDFont font,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             org.openmali.vecmath2.Colorf color)
Creates a new Label with the given width, height and z-index.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             HUDFont font)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height,
             java.lang.String text,
             HUDFont font,
             TextAlignment alignment)
Creates a new Label with the given width and height and a z-index of 0.

Parameters:
isHeavyWeight -
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(boolean isHeavyWeight,
             float width,
             float height)
Creates a new Label with the given width and height and no text initially.

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

Label

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

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

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(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(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(float width,
             float height,
             java.lang.String text,
             HUDFont 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(float width,
             float height,
             java.lang.String text,
             HUDFont 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
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,
             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
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,
             HUDFont 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(float width,
             float height,
             java.lang.String text,
             HUDFont 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(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(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

setPadding

public boolean setPadding(int paddingBottom,
                          int paddingRight,
                          int paddingTop,
                          int 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(int 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 final int 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 final int 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 final int 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 final int 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.

Specified by:
setAutoSizeEnabled in interface AutoSizable
Parameters:
enabled -

isAutoSizeEnabled

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

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

setText

public void setText(java.lang.String prefix,
                    float value,
                    char decimalSep,
                    int decPlaces,
                    java.lang.String postfix)
Sets the text from a float.

Parameters:
prefix - null for no prefix
value - the value
decimalSep - '\0' for no decimal places
decPlaces -
postfix - null for no postfix

setText

public final void setText(float value)
Sets the text from a float.
The value will be formatted with a dot ('.') as decimal separator and 2 decimal places.

Parameters:
value - the value

getText

public java.lang.String getText()

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

getDisplayedText

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

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(HUDFont font)
Sets the new Font to be used

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

getFont

public final HUDFont getFont()

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

setFontDisabled

public void setFontDisabled(HUDFont font)


getFontDisabled

public final HUDFont getFontDisabled()


getFont

protected HUDFont 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)

setIcon

public void setIcon(Texture2D icon)
Sets the icon for this Label.

Parameters:
icon -

setIcon

public final void setIcon(java.lang.String icon)
Sets the icon for this Label.

Parameters:
icon -

getIcon

public final Texture2D getIcon()
Gets the icon of this Label.

Returns:
the icon of this Label.

setIconGap

public void setIconGap(int gap)
Sets the gap between the icon and the text.

Parameters:
gap - the gap in pixels

getIconGap

public final int getIconGap()
Gets the gap between the icon and the text.

Returns:
gap the gap in pixels

setEnabledImpl

protected void setEnabledImpl(boolean enabled)
Parameters:
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

onSizeChanged

protected void onSizeChanged(float oldWidth,
                             float oldHeight,
                             float newWidth,
                             float newHeight)

Overrides:
onSizeChanged in class Widget

onAttachedToHUD

protected void onAttachedToHUD(HUD hud)
Description copied from class: Widget
This event is fired, when this Widget is added to the HUD live Widget hierarchy.

Overrides:
onAttachedToHUD in class Widget
Parameters:
hud - the HUD, the Widget is added to

getMinimalSize

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

Specified by:
getMinimalSize in interface AutoSizable
Returns:
the buffer back again.

setMinimalSize

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

Specified by:
setMinimalSize in interface AutoSizable

getMinimalWidth

public final float getMinimalWidth()
Gets the Label's minimum width.

Specified by:
getMinimalWidth in interface AutoSizable
Returns:
the minimum width.

getMinimalHeight

public final float getMinimalHeight()
Gets the Label's minimum height.

Specified by:
getMinimalHeight in interface AutoSizable
Returns:
the minimum height.

setTextOffset

public void setTextOffset(int textOffsetX,
                          int textOffsetY)

getTextOffsetX

public int getTextOffsetX()

getTextOffsetY

public int getTextOffsetY()

prepareText

protected void prepareText(MultilineText multiLineText,
                           Texture2DCanvas texCanvas,
                           int width,
                           int height)

drawIcon

protected void drawIcon(Texture2D icon,
                        Texture2DCanvas texCanvas,
                        int x,
                        int y)

drawText

protected void drawText(MultilineText multiLineText,
                        Texture2DCanvas texCanvas,
                        int offsetX,
                        int offsetY,
                        int width,
                        int height)
Draws the text on the Label.

Parameters:
multiLineText -
texCanvas -
offsetX -
offsetY -
width -
height -

drawWidget

protected void drawWidget(Texture2DCanvas texCanvas,
                          int offsetX,
                          int offsetY,
                          int width,
                          int height,
                          boolean drawsSelf)
Specified by:
drawWidget in class Widget

initSize

protected void initSize()

Overrides:
initSize in class Widget

init

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

Specified by:
init in class Widget