Class Input


  extended by Object
      extended by Component
          extended by Text
              extended by Input
Direct Known Subclasses:
NativeInput

public class Input
extends Text

Creates text field component used for input. This component always uses native MIDP2 TextBox screen for input.

Input field has set of flags. One of the type flags may be specified along with any number of modifier flags. Note that flags must also contain normal Component flags.

Type flags are:

Modifier flags are:

Input has following special style customizations:


Constructor Summary
Input(Style style, String text, int flags)
          Creates a new Input component.
Input(Style style, String title, String text, int flags)
          Creates a new Input component.
 
Method Summary
 void edit()
           Opens the full screen edit mode for this input field.
 void edit(ActionCallback callback)
           Opens the full screen edit mode for this input field.
 int getCapacity()
          Gets the capacity (number of characters) that can be contained in this Input.
 void setCapacity(int capacity)
          Sets the capacity (number of characters) that can be contained in this Input.
 
Methods inherited from class Component
add, appendText, clear, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Input

public Input(Style style,
             String text,
             int flags)
Creates a new Input component. Capacity is set to zero ("infinite").

Parameters:
style - Style to use
text - Initial contents of field
flags - Component flags

Input

public Input(Style style,
             String title,
             String text,
             int flags)
Creates a new Input component. Capacity is set to zero ("infinite").

Parameters:
style - Style to use
text - Initial content of field
title - Optional title to show while on (full screen) edit mode
flags - Component flags
Method Detail

edit

public void edit()

Opens the full screen edit mode for this input field. This method may be called even if the field hasn't been placed on any Shell structure. By default the edit mode is activated when user clicks "fire" key when focused on field.

Once the edit has completed Script.actionPerformed(Shell, Component, int) is called with this Input as source argument. If field was changed the action is ITEM_CHANGED otherwise ITEM_CANCEL.


edit

public void edit(ActionCallback callback)

Opens the full screen edit mode for this input field. This method may be called even if the field hasn't been placed on any Shell structure. By default the edit mode is activated when user clicks "fire" key when focused on field.

Once the edit has completed ActionCallback.actionPerformed(Shell, Component, int) is called with this Input as source argument. If field was changed the action is ITEM_CHANGED otherwise ITEM_CANCEL.


getCapacity

public int getCapacity()
Gets the capacity (number of characters) that can be contained in this Input.

Returns:
current capacity of this Input field

setCapacity

public void setCapacity(int capacity)
Sets the capacity (number of characters) that can be contained in this Input. If the current contents of the Input are larger than capacity, the contents are truncated to fit. Capacity that is zero or negative indicates "infinite" capacity.

Parameters:
capacity - New capacity for this Input field