Class BlackBerryTextBox

  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Screen
          extended by javax.microedition.lcdui.TextBox
              extended by net.rim.device.api.lcdui.BlackBerryTextBox
All Implemented Interfaces:

public class BlackBerryTextBox
extends TextBox
implements Controllable

The BlackBerryTextBox class extends the functionality of the TextBox class.

The BlackBerryTextBox class implements Controllable and can be queried to retrieve BlackBerry-specific Controls. For instance, on devices which support a virtual keyboard, BlackBerryTextBox.getControl(String) may return a VirtualKeyboardControl object.

BlackBerry API 4.7.0

Constructor Summary
BlackBerryTextBox(String title, String text, int maxSize, int constraints)
          Creates a new instance of a BlackBerryTextBox.
Method Summary
 Control getControl(String controlType)
          Obtain the object that implements the specified Control interface.
 Control[] getControls()
          Obtain the collection of Controls from the object that implements this interface.
Methods inherited from class javax.microedition.lcdui.TextBox
delete, getCaretPosition, getChars, getConstraints, getMaxSize, getString, insert, insert, setChars, setConstraints, setInitialInputMode, setMaxSize, setString, size
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle, sizeChanged
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public BlackBerryTextBox(String title,
                         String text,
                         int maxSize,
                         int constraints)
Creates a new instance of a BlackBerryTextBox.

IllegalArgumentException - if maxSize is zero or less
IllegalArgumentException - if the constraints parameter is invalid
IllegalArgumentException - if text is illegal for the specified constraints
IllegalArgumentException - if the length of the string exceeds the requested maximum capacity or the maximum capacity actually assigned
See Also:
javax.microedtion.lcdui.TextBox#TextBox(String, String, int, int)
BlackBerry API 4.7.0

Method Detail


public Control[] getControls()
Description copied from interface: Controllable
Obtain the collection of Controls from the object that implements this interface.

Since a single object can implement multiple Control interfaces, it's necessary to check each object against different Control types. For example:

Controllable controllable;
Control cs[];
cs = controllable.getControls();
for (int i = 0; i < cs.length; i++) {
    if (cs[i] instanceof ControlTypeA)
    if (cs[i] instanceof ControlTypeB)
    // etc.

The list of Control objects returned will not contain any duplicates. And the list will not change over time.

If no Control is supported, a zero length array is returned.

Specified by:
getControls in interface Controllable
the collection of Control objects.
See Also:
BlackBerry API 4.7.0


public Control getControl(String controlType)
Description copied from interface: Controllable
Obtain the object that implements the specified Control interface.

If the specified Control interface is not supported then null is returned.

If the Controllable supports multiple objects that implement the same specified Control interface, only one of them will be returned. To obtain all the Control's of that type, use the getControls method and check the list for the requested type.

Specified by:
getControl in interface Controllable
controlType - the class name of the Control. The class name should be given either as the fully-qualified name of the class; or if the package of the class is not given, the package is assumed.
the object that implements the control, or null.
IllegalArgumentException - Thrown if controlType is null.
See Also:
BlackBerry API 4.7.0

Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.