|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xith3d.ui.hud.base.Widget
org.xith3d.ui.hud.base.BackgroundSettableWidget
org.xith3d.ui.hud.widgets.Label
public class Label
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. |
|
|
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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final boolean DEFAULT_HEAVYWEIGHT
| Constructor Detail |
|---|
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)
isHeavyWeight - hasWidgetAssembler - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont_enabled - font_disabled - fontColor_enabled - fontColor_disabled - alignment - backgroundColor - backgroundTexture -
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)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont_enabled - font_disabled - fontColor_enabled - fontColor_disabled - alignment - backgroundColor - backgroundTexture -
protected Label(boolean isHeavyWeight,
boolean hasWidgetAssembler,
float width,
float height,
java.lang.String text,
Label.Description labelDesc)
isHeavyWeight - hasWidgetAssembler - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetlabelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
Label.Description labelDesc)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetlabelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
HUDFont font,
org.openmali.vecmath2.Colorf color,
TextAlignment alignment)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textcolor - the color to be usedalignment - the horizontal and vertical alignment
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
TextAlignment alignment)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetalignment - the horizontal and vertical alignment
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
org.openmali.vecmath2.Colorf color,
TextAlignment alignment)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetcolor - the color to be usedalignment - the horizontal and vertical alignment
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
HUDFont font,
org.openmali.vecmath2.Colorf color)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textcolor - the color to be used
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
org.openmali.vecmath2.Colorf color)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetcolor - the color to be used
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
HUDFont font)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the text
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text,
HUDFont font,
TextAlignment alignment)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textalignment - the horizontal and vertical alignment
public Label(boolean isHeavyWeight,
float width,
float height)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widget
public Label(boolean isHeavyWeight,
float width,
float height,
java.lang.String text)
isHeavyWeight - width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidget
public Label(float width,
float height,
java.lang.String text,
Label.Description labelDesc)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetlabelDesc - a LabelDescription instance holding information about font, color, alignment and background-texture
public Label(float width,
float height,
java.lang.String text,
TextAlignment alignment)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetalignment - the horizontal and vertical alignment
public Label(float width,
float height,
java.lang.String text,
org.openmali.vecmath2.Colorf color,
TextAlignment alignment)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetcolor - the color to be usedalignment - the horizontal and vertical alignment
public Label(float width,
float height,
java.lang.String text,
HUDFont font,
org.openmali.vecmath2.Colorf color,
TextAlignment alignment)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textcolor - the color to be usedalignment - the horizontal and vertical alignment
public Label(float width,
float height,
java.lang.String text,
HUDFont font,
org.openmali.vecmath2.Colorf color)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textcolor - the color to be used
public Label(float width,
float height,
java.lang.String text,
org.openmali.vecmath2.Colorf color)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetcolor - the color to be used
public Label(float width,
float height,
java.lang.String text,
HUDFont font)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the text
public Label(float width,
float height,
java.lang.String text,
HUDFont font,
TextAlignment alignment)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidgetfont - the Font to be used for the textalignment - the horizontal and vertical alignment
public Label(float width,
float height)
width - the new width of this Widgetheight - the new height of this Widget
public Label(float width,
float height,
java.lang.String text)
width - the new width of this Widgetheight - the new height of this Widgettext - the text to display in this TextWidget| Method Detail |
|---|
public boolean setPadding(int paddingBottom,
int paddingRight,
int paddingTop,
int paddingLeft)
setPadding in interface PaddingSettablepublic final boolean setPadding(int padding)
setPadding in interface PaddingSettablepadding - padding for bottom, right, top and left
public final int getPaddingBottom()
getPaddingBottom in interface PaddingSettablepublic final int getPaddingRight()
getPaddingRight in interface PaddingSettablepublic final int getPaddingTop()
getPaddingTop in interface PaddingSettablepublic final int getPaddingLeft()
getPaddingLeft in interface PaddingSettablepublic void setAutoSizeEnabled(boolean enabled)
setAutoSizeEnabled in interface AutoSizableenabled - public final boolean isAutoSizeEnabled()
isAutoSizeEnabled in interface AutoSizableprotected void updateText()
public void setText(java.lang.String text)
setText in interface TextWidgettext - the new Text
public void setText(java.lang.String prefix,
float value,
char decimalSep,
int decPlaces,
java.lang.String postfix)
prefix - null for no prefixvalue - the valuedecimalSep - '\0' for no decimal placesdecPlaces - postfix - null for no postfixpublic final void setText(float value)
value - the valuepublic java.lang.String getText()
getText in interface TextWidgetprotected java.lang.String getDisplayedText()
public void setAlignment(TextAlignment alignment)
setAlignment in interface TextWidgetpublic TextAlignment getAlignment()
getAlignment in interface TextWidgetpublic void setFont(HUDFont font)
setFont in interface TextWidgetfont - the new Fontpublic final HUDFont getFont()
getFont in interface TextWidgetpublic void setFontDisabled(HUDFont font)
public final HUDFont getFontDisabled()
protected HUDFont getFont(boolean disabled)
public void setFontColor(org.openmali.vecmath2.Colorf color)
setFontColor in interface TextWidgetcolor - the new colorpublic final org.openmali.vecmath2.Colorf getFontColor()
getFontColor in interface TextWidgetpublic void setFontColorDisabled(org.openmali.vecmath2.Colorf color)
public final org.openmali.vecmath2.Colorf getFontColorDisabled()
protected org.openmali.vecmath2.Colorf getFontColor(boolean disabled)
public void setIcon(Texture2D icon)
icon - public final void setIcon(java.lang.String icon)
icon - public final Texture2D getIcon()
public void setIconGap(int gap)
gap - the gap in pixelspublic final int getIconGap()
protected void setEnabledImpl(boolean enabled)
enabled - public final void setEnabled(boolean enabled)
setEnabled in interface org.jagatoo.datatypes.Enableablepublic final boolean isEnabled()
isEnabled in interface org.jagatoo.datatypes.Enableable
protected void onSizeChanged(float oldWidth,
float oldHeight,
float newWidth,
float newHeight)
onSizeChanged in class Widgetprotected void onAttachedToHUD(HUD hud)
Widget
onAttachedToHUD in class Widgethud - the HUD, the Widget is added topublic <Dim2f_ extends org.openmali.types.twodee.Dim2f> Dim2f_ getMinimalSize(Dim2f_ buffer)
getMinimalSize in interface AutoSizablepublic final void setMinimalSize()
setMinimalSize in interface AutoSizablepublic final float getMinimalWidth()
getMinimalWidth in interface AutoSizablepublic final float getMinimalHeight()
getMinimalHeight in interface AutoSizable
public void setTextOffset(int textOffsetX,
int textOffsetY)
public int getTextOffsetX()
public int getTextOffsetY()
protected void prepareText(MultilineText multiLineText,
Texture2DCanvas texCanvas,
int width,
int height)
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)
multiLineText - texCanvas - offsetX - offsetY - width - height -
protected void drawWidget(Texture2DCanvas texCanvas,
int offsetX,
int offsetY,
int width,
int height,
boolean drawsSelf)
drawWidget in class Widgetprotected void initSize()
initSize in class Widgetprotected void init()
init in class Widget
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||