brf.j2me.dynaworks.ui
Class TextField

java.lang.Object
  |
  +--brf.j2me.dynaworks.ui.BasicWidget
        |
        +--brf.j2me.dynaworks.ui.TextField
All Implemented Interfaces:
UserWidget

public class TextField
extends BasicWidget

Text field with caret.

Version:
1.0
Author:
Bernd R. Fix
See Also:
BasicWidget, UserWidget

Inner Class Summary
 class TextField.Caret
          thread object for blinking caret.
 
Field Summary
private  TextField.Caret caret
          Thread object and position of blinking caret.
private  java.lang.String charset
          ASCII characters
private  java.lang.String content
          text field content.
private  boolean focus
          do we have focus?
 
Fields inherited from class brf.j2me.dynaworks.ui.BasicWidget
g, h, w, x, y
 
Constructor Summary
TextField(java.lang.String text, int x, int y, int w, int h)
          constructor.
 
Method Summary
 java.lang.String getText()
          get the text from the control.
 ActionEvent handleKeyDown(int keyCode)
          Handle a "keyDown" event.
 boolean hasFocus()
          Does the control have the focus?
 void loseFocus()
          control is losing the focus.
 void paint()
          Paint the user control.
 void setFocus()
          set the focus on this control
 void setText(java.lang.String txt)
          set the text for this control.
 
Methods inherited from class brf.j2me.dynaworks.ui.BasicWidget
, contains, handlePenDown, handlePenMove, handlePenUp, handleSysKeyDown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

charset

private final java.lang.String charset
ASCII characters

content

private java.lang.String content
text field content.


focus

private boolean focus
do we have focus?


caret

private TextField.Caret caret
Thread object and position of blinking caret.
Constructor Detail

TextField

public TextField(java.lang.String text,
                 int x,
                 int y,
                 int w,
                 int h)
constructor.

Parameters:
text - String - content of the text field.
x - int - x coordinate of upper-left corner.
y - int - y coordinate of upper-left corner.
w - int - width of the control.
h - int - height of the control.
Method Detail

setFocus

public void setFocus()
set the focus on this control

Overrides:
setFocus in class BasicWidget

hasFocus

public boolean hasFocus()
Does the control have the focus?

Overrides:
hasFocus in class BasicWidget
Returns:
boolean - focus on this control?

loseFocus

public void loseFocus()
control is losing the focus.

Overrides:
loseFocus in class BasicWidget

setText

public void setText(java.lang.String txt)
set the text for this control.

Parameters:
txt - String - text for this control.

getText

public java.lang.String getText()
get the text from the control.

Returns:
String - text of this control.

handleKeyDown

public ActionEvent handleKeyDown(int keyCode)
Handle a "keyDown" event. Return an ActionEvent if neccessary.

Overrides:
handleKeyDown in class BasicWidget
Parameters:
key - int - key send to the control.
Returns:
ActionEvent - event triggered by keyDown (or null).
See Also:
ActionEvent

paint

public void paint()
Paint the user control.

Overrides:
paint in class BasicWidget