org.xith3d.ui.hud.widgets
Class TextField

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
              extended by org.xith3d.ui.hud.widgets.TextField
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, BorderSettable, PaddingSettable, TextWidget, Widget

public class TextField
extends Label
implements BorderSettable

A TextField is a Widget that allows for editing a single line of text.


Nested Class Summary
static class TextField.Description
           
 
Nested classes/interfaces inherited from interface org.xith3d.ui.hud.base.Widget
Widget.DescriptionBase
 
Field Summary
 
Fields inherited from class org.xith3d.ui.hud.widgets.Label
autoSize
 
Fields inherited from class org.xith3d.ui.hud.base.WidgetBase
containerListeners, transformGroup, translation, Z_INDEX_UNIT, Z_INDEX_UNIT_ASSEMBLER
 
Constructor Summary
TextField(float width, float height)
          Creates a new TextField with the given width and height and no text initially.
TextField(float width, float height, int zIndex)
          Creates a new TextField with the given width, height and z-index and no text initially.
TextField(float width, float height, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width, height and z-index.
TextField(float width, float height, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and z-index.
TextField(float width, float height, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width, height and z-index.
TextField(float width, float height, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width, height and z-index.
TextField(float width, float height, int zIndex, java.lang.String text, TextAlignment alignment)
          Creates a new TextField with the given width and height and z-index.
TextField(float width, float height, int zIndex, java.lang.String text, TextField.Description textFieldDesc)
          Creates a new Label with the given width, height and z-index.
TextField(float width, float height, java.lang.String text)
          Creates a new TextField with the given width and height and no text initially.
TextField(float width, float height, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, java.awt.Font font)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, java.awt.Font font, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(float width, float height, java.lang.String text, TextField.Description textFieldDesc)
          Creates a new TextField with the given width, height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size)
          Creates a new TextField with the given width and height and no text initially.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex)
          Creates a new TextField with the given width, height and z-index and no text initially.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width, height and z-index.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and z-index.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width, height and z-index.
TextField(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 TextField with the given width, height and z-index.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, TextAlignment alignment)
          Creates a new TextField with the given width and height and z-index.
TextField(org.openmali.types.twodee.Sized2fRO size, int zIndex, java.lang.String text, TextField.Description textFieldDesc)
          Creates a new TextField with the given width, height and z-index.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text)
          Creates a new TextField with the given width and height and no text initially.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, org.openmali.vecmath2.Colorf color, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, java.awt.Font font, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, TextAlignment alignment)
          Creates a new TextField with the given width and height and a z-index of 0.
TextField(org.openmali.types.twodee.Sized2fRO size, java.lang.String text, TextField.Description textFieldDesc)
          Creates a new TextField with the given width, height and a z-index of 0.
 
Method Summary
 void addTextFieldListener(TextFieldListener l)
          Adds a listener, that is notified of special TextField events.
protected  void fixTranslation(org.openmali.vecmath2.Tuple2f offset)
           
 Border getBorder()
          
 int getCaretPosition()
           
 java.lang.String getDisplayedText()
          
 char getEchoChar()
           
 char[] getIgnoredChars()
           
 float getPaddingBottom()
          
 float getPaddingLeft()
          
 float getPaddingRight()
          
 float getPaddingTop()
          
 float getTransparency()
          
protected  void init()
          This method is called when the WidgetContainer is set.
 boolean isEchoMode()
           
 boolean isEditable()
           
 void onDetached()
          This method is called right before the Widget has been detached from its WidgetContainer.
 void onKeyReleased(org.jagatoo.input.devices.components.Key key, long when)
          This event is fired, when a key is released on a focused Widget.
 void onKeyTyped(char ch, long when)
          This event is fired when a key is typed on the keyboard.
 void removeTextFieldListener(TextFieldListener l)
          Removes a TextFieldListener from the list.
 void setBorder(Border.Description borderDesc)
          Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).
 void setBorder(Border border)
          Sets the Border to use for this BorderSettable Widget.
 void setCaretPosition(int pos)
           
 void setEchoChar(char echoChar)
          Sets the character to replace each character of the TextField's text with when in echo-mode.
 void setEchoMode(boolean echoMode)
          Enables/Disables the echo-mode.
 void setEchoMode(boolean echoMode, char echoChar)
          Enables/Disables the echo-mode.
 void setEditable(boolean editable)
          Enables or disables the editability of this TextField.
 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 setIgnoredChars(char... ignoredChars)
          Sets the array of chars ignored by this TextField.
 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.
 void update()
          Updates the Widget's internals.
protected  void updateText()
          
 void updateTranslation()
          Effectively changes the translation of this Widget (location and z-index)
 
Methods inherited from class org.xith3d.ui.hud.widgets.Label
getAlignment, getBackground, getBackgroundColor, getBackgroundTileHeight, getBackgroundTileSize, getBackgroundTileWidth, getContentGroup, getFont, getFont, getFontColor, getFontColor, getFontColorDisabled, getFontDisabled, getMinimalSize, getText, getTextRectangle, isAutoSizeEnabled, isEnabled, setAlignment, setAutoSizeEnabled, setBackground, setBackground, setBackground, setBackgroundTileSize, setBackgroundTileSize, setContainer, setEnabled, setEnabledImpl, setFontColorDisabled, setFontDisabled, setMinimalSize, setPadding, toString
 
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, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, 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
 
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, onFocusGained, onFocusLost, onInputStateChanged, onKeyPressed, 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
 
Methods inherited from interface org.openmali.types.twodee.Sized2f
setHeight, setWidth
 

Constructor Detail

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 TextField.Description textFieldDesc)
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
textFieldDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 TextField.Description textFieldDesc)
Creates a new TextField with the given width, 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
textFieldDesc - a LabelDescription instance holding information about font, color, alignment and background-texture

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 java.lang.String text,
                 TextField.Description textFieldDesc)
Creates a new TextField 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
textFieldDesc - a TextField.Description instance holding information about font, color, alignment and background-texture

TextField

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

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

TextField

public TextField(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 TextField 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

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 java.lang.String text,
                 TextAlignment alignment)
Creates a new TextField with the given width and 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
alignment - the horizontal and vertical alignment

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 TextAlignment alignment)
Creates a new TextField with the given width and 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
alignment - the horizontal and vertical alignment

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField with the given width and 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
alignment - the horizontal and vertical alignment

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField with the given width and 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
alignment - the horizontal and vertical alignment

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 java.awt.Font font,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 int zIndex,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 org.openmali.vecmath2.Colorf color)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 java.awt.Font font)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 java.awt.Font font)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text,
                 java.awt.Font font,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text,
                 java.awt.Font font,
                 TextAlignment alignment)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 int zIndex)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 int zIndex)
Creates a new TextField 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

TextField

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

Parameters:
size - the new size of this Widget

TextField

public TextField(float width,
                 float height)
Creates a new TextField 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

TextField

public TextField(org.openmali.types.twodee.Sized2fRO size,
                 java.lang.String text)
Creates a new TextField 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

TextField

public TextField(float width,
                 float height,
                 java.lang.String text)
Creates a new TextField 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

addTextFieldListener

public final void addTextFieldListener(TextFieldListener l)
Adds a listener, that is notified of special TextField events.

Parameters:
l -

removeTextFieldListener

public final void removeTextFieldListener(TextFieldListener l)
Removes a TextFieldListener from the list.

Parameters:
l -

setTransparency

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

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

getTransparency

public float getTransparency()

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

setEditable

public void setEditable(boolean editable)
Enables or disables the editability of this TextField. If not editable, no key-events will be processed and the carret won't be visible.

Parameters:
editable -

isEditable

public boolean isEditable()
Returns:
the editability of this TextField. If not editable, no key-events will be processed and the carret won't be visible.

setBorder

public void setBorder(Border border)
Sets the Border to use for this BorderSettable Widget.

Specified by:
setBorder in interface BorderSettable
Parameters:
border - the new Border (null for no border)

setBorder

public void setBorder(Border.Description borderDesc)
Creates a new Border from the given Border.Desctiption and invokes setBorder(Border).

Specified by:
setBorder in interface BorderSettable
Parameters:
borderDesc - the Border.Description to create the new Border from (null for no border)
See Also:
BorderSettable.setBorder(Border)

getBorder

public final Border getBorder()

Specified by:
getBorder in interface BorderSettable
Returns:
the Border used for this BorderSettable Widget

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
Overrides:
setPadding in class Label
Returns:
true, if the padding actually has changed

getPaddingBottom

public float getPaddingBottom()

Specified by:
getPaddingBottom in interface PaddingSettable
Overrides:
getPaddingBottom in class Label
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
Overrides:
getPaddingRight in class Label
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
Overrides:
getPaddingTop in class Label
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
Overrides:
getPaddingLeft in class Label
Returns:
left-padding for this PaddingSettable Widget.
Padding translates local coordinates and shrinks the clipping area.

setCaretPosition

public void setCaretPosition(int pos)

getCaretPosition

public int getCaretPosition()

setEchoChar

public void setEchoChar(char echoChar)
Sets the character to replace each character of the TextField's text with when in echo-mode.

Parameters:
echoChar -

getEchoChar

public char getEchoChar()
Returns:
the character to replace each character of the TextField's text with when in echo-mode.

setEchoMode

public void setEchoMode(boolean echoMode,
                        char echoChar)
Enables/Disables the echo-mode.
In echo-mode each character of the TextField's text will be replaced with the echo char.

Parameters:
echoMode -
echoChar -

setEchoMode

public void setEchoMode(boolean echoMode)
Enables/Disables the echo-mode.
In echo-mode each character of the TextField's text will be replaced with the echo char.

Parameters:
echoMode -

isEchoMode

public boolean isEchoMode()
Returns:
the echo-mode.
In echo-mode each character of the TextField's text will be replaced with the echo char.

setIgnoredChars

public void setIgnoredChars(char... ignoredChars)
Sets the array of chars ignored by this TextField.

Parameters:
ignoredChars -

getIgnoredChars

public char[] getIgnoredChars()
Returns:
the array of chars ignored by this TextField.

getDisplayedText

public java.lang.String getDisplayedText()

Overrides:
getDisplayedText in class Label
Returns:
the text, that is actually displayed on the Label.

updateText

protected void updateText()

Overrides:
updateText in class Label

setText

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

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

setFontColor

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

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

setFont

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

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

onKeyReleased

public void onKeyReleased(org.jagatoo.input.devices.components.Key key,
                          long when)
This event is fired, when a key is released on a focused Widget.

Specified by:
onKeyReleased in interface Widget
Overrides:
onKeyReleased in class WidgetBase
Parameters:
key - the key that was released
when - the keyevent's timestamp

onKeyTyped

public void onKeyTyped(char ch,
                       long when)
This event is fired when a key is typed on the keyboard.

Specified by:
onKeyTyped in interface Widget
Overrides:
onKeyTyped in class WidgetBase
Parameters:
ch - the typed key's character
when - the keyevent's timestamp

setSize

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

Overrides:
setSize in class Label

fixTranslation

protected void fixTranslation(org.openmali.vecmath2.Tuple2f offset)
Overrides:
fixTranslation in class Label

update

public void update()
Updates the Widget's internals.
Called by the Widget system and can be called from outside.

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

updateTranslation

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

Overrides:
updateTranslation in class Label

onDetached

public void onDetached()
This method is called right before the Widget has been detached from its WidgetContainer.

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

init

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

Overrides:
init in class Label