fds.micro.ui
Class DigitTextField

java.lang.Object
  extended byfds.micro.ui.Component
      extended byfds.micro.ui.TextField
          extended byfds.micro.ui.DigitTextField

public class DigitTextField
extends TextField

This class implements a text field that accepts only digit from zero to nine.
An object of this class is dedicated to be used within an object of fds.micro.ui.AbstractPanel sub-class (J2ME).

Author:
Frédéric DE STEUR
See Also:
TextField

Field Summary
 
Fields inherited from class fds.micro.ui.TextField
LABEL_LEFT, LABEL_TOP
 
Fields inherited from class fds.micro.ui.Component
INTERN_BOTTOM_VALIGN, INTERN_CENTER_HALIGN, INTERN_CENTER_VALIGN, INTERN_LEFT_HALIGN, INTERN_RIGHT_HALIGN, INTERN_TOP_VALIGN
 
Constructor Summary
DigitTextField()
          Build an empty text field without .
DigitTextField(int maxLength)
          Build an empty text field without label.
DigitTextField(int maxLength, java.lang.String label)
          Build an empty text field with specified label.
DigitTextField(int maxLength, java.lang.String label, java.lang.String text)
          Build a text field with specified label and initialized with given value.
DigitTextField(java.lang.String label)
          Build an empty text field with specified label.
DigitTextField(java.lang.String label, java.lang.String text)
          Build a text field with specified label and initialized with given value.
 
Method Summary
 void keyPressed(int keyCode, int gameAction)
          Called to notify the component that a key is pressed.
 void setText(java.lang.String text)
          Set the field value.
 
Methods inherited from class fds.micro.ui.TextField
addValueChangeListener, getCursorPosition, getLabel, getLabelFont, getLabelPosition, getLength, getText, getTextFont, isBoxOpaque, pointerPressed, removeValueChangListener, setBorderColor, setBoxOpaque, setCursorColor, setCursorPosition, setFieldBackground, setFieldBackgroundOff, setLabel, setLabelColor, setLabelFont, setLabelPosition, setMaximumSize, setTextColor, setTextColorOff, setTextFont
 
Methods inherited from class fds.micro.ui.Component
addFocusListener, addItemListener, equals, getHAlign, getHeight, getParent, getVAlign, getWidth, getX, getY, isDisabled, isHaveFocus, isHidden, isManageFocus, isOpaque, removeFocusListener, removeItemListener, setBackground, setDisabled, setFocusColor, setHAlign, setHidden, setLocation, setManageFocus, setOpaque, setVAlign
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigitTextField

public DigitTextField()
Build an empty text field without .


DigitTextField

public DigitTextField(int maxLength)
Build an empty text field without label.

Parameters:
maxLength - The maximum length for this field.

DigitTextField

public DigitTextField(int maxLength,
                      java.lang.String label)
Build an empty text field with specified label.

Parameters:
maxLength - The maximum length for this field.
label - Label to display before the field (null if no label).

DigitTextField

public DigitTextField(int maxLength,
                      java.lang.String label,
                      java.lang.String text)
Build a text field with specified label and initialized with given value.

Parameters:
maxLength - The maximum length for this field.
label - Label to display before the field (null if no label).
text - Initial field value.

DigitTextField

public DigitTextField(java.lang.String label)
Build an empty text field with specified label.

Parameters:
label - Label to display before the field (null if no label).

DigitTextField

public DigitTextField(java.lang.String label,
                      java.lang.String text)
Build a text field with specified label and initialized with given value.

Parameters:
label - Label to display before the field (null if no label).
text - Initial field value.
Method Detail

keyPressed

public void keyPressed(int keyCode,
                       int gameAction)
Called to notify the component that a key is pressed.

Overrides:
keyPressed in class TextField
Parameters:
keyCode - The key code.
gameAction - Game action corresponding to the key code.

setText

public void setText(java.lang.String text)
Set the field value.

Overrides:
setText in class TextField
Parameters:
text - The new field value.