Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class TextArea

java.lang.Object
  extended by com.sun.dtv.lwuit.Component
      extended by com.sun.dtv.lwuit.TextArea
All Implemented Interfaces:
Animation, StyleListener, Animated
Direct Known Subclasses:
TextField

public class TextArea
extends Component

An optionally multi-line editable region that can display text and allow a user to edit it. Depending on the platform editing might occur in a new screen. Notice that when creating a text area with one row it will act as a text field and never grow beyond that, however when assigning a greater number of rows the text area becomes multi-line with a minimum number of visible rows, the text area will grow based on its content.


Field Summary
static int ANY
          Allows any type of input into a text field, if a constraint is not supported by an underlying implementation this will be the default.
static int DECIMAL
          The user is allowed to enter numeric values with optional decimal fractions, for example "-123", "0.123", or ".5".
static int EMAILADDR
          The user is allowed to enter an e-mail address.
static int INITIAL_CAPS_SENTENCE
          This flag is a hint to the implementation that during text editing, the initial letter of each sentence should be capitalized.
static int INITIAL_CAPS_WORD
          This flag is a hint to the implementation that during text editing, the initial letter of each word should be capitalized.
static int NON_PREDICTIVE
          Indicates that the text entered does not consist of words that are likely to be found in dictionaries typically used by predictive input schemes.
static int NUMERIC
          The user is allowed to enter only an integer value.
static int PASSWORD
          Indicates that the text entered is confidential data that should be obscured whenever possible.
static int PHONENUMBER
          The user is allowed to enter a phone number.
static int SENSITIVE
          Indicates that the text entered is sensitive data that the implementation must never store into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes.
static int UNEDITABLE
          Indicates that editing is currently disallowed.
static int URL
          The user is allowed to enter a URL.
 
Fields inherited from class com.sun.dtv.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
TextArea()
          Creates an empty text area, this constructor will create a single line text area similar to a text field!
TextArea(int rows, int columns)
          Creates an area with the given rows and columns.
TextArea(int rows, int columns, int constraint)
          Creates an area with the given rows, columns and constraint.
TextArea(String text)
          Creates an area with the given text, this constructor will create a single line text area similar to a text field!
TextArea(String text, int maxSize)
          Creates an area with the given text and maximum size, this constructor will create a single line text area similar to a text field!
TextArea(String text, int rows, int columns)
          Creates an area with the given text, rows and columns.
TextArea(String text, int rows, int columns, int constraint)
          Creates an area with the given text, rows, columns and constraint.
 
Method Summary
 void addActionListener(ActionListener a)
          Add an action listener which is invoked when the text area was modified not during modification.
 int getColumns()
          Returns the number of columns in the text area.
 int getConstraint()
          Returns the editing constraint value.
 int getLines()
          Returns the number of text lines in the TextArea.
 int getMaxSize()
          Returns the maximum size for the text area.
 int getRows()
          Returns the number of rows in the text area.
 int getRowsGap()
          Gets the num of pixels gap between the rows.
 String getText()
          Returns the text in the text area.
 String getTextAt(int line)
          Returns the text at the given row of the text box.
 String getUnsupportedChars()
          Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts.
static boolean isAutoDegradeMaxSize()
          Indicates whether a high value for default maxSize will be reduced to a lower value if the underlying platform throws an exception.
 boolean isEditable()
          Returns true if this area is editable.
 boolean isGrowByContent()
          Indicates that the text area should "grow" in height based on the content beyond the limits indicate by the rows variable.
 boolean isScrollableY()
          Indicates whether the component should/could scroll on the Y axis.
 void keyPressed(int keyCode)
          If this Component is focused, the key pressed event will call this method.
 void keyReleased(int keyCode)
          If this Component is focused, the key released event will call this method.
 void paint(Graphics g)
          This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method.
 void removeActionListener(ActionListener a)
          Removes an action listener.
static void setAutoDegradeMaxSize(boolean value)
          Indicates whether a high value for default maxSize will be reduced to a lower value if the underlying platform throws an exception.
 void setColumns(int columns)
          Sets the number of columns in the text area.
 void setConstraint(int constraint)
          Sets the constraint.
static void setDefaultMaxSize(int value)
          Sets the default limit for the native text box size.
 void setEditable(boolean b)
          Sets this text area to be editable or readonly.
 void setGrowByContent(boolean growByContent)
          Indicates that the text area should "grow" in height based on the content beyond the limits indicate by the rows variable.
 void setMaxSize(int maxSize)
          Sets the maximum size of the text area.
 void setRows(int rows)
          Sets the number of rows in the text area.
 void setRowsGap(int rowsGap)
          The gap in pixels between rows.
 void setText(String t)
          Sets the text within this text area.
 void setUnsupportedChars(String unsupportedChars)
          Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts.
 
Methods inherited from class com.sun.dtv.lwuit.Component
addFocusListener, animate, calcPreferredSize, contains, deinitialize, getAbsoluteX, getAbsoluteY, getAnimationMode, getBaseline, getBaselineResizeBehavior, getBottomGap, getBounds, getClientProperty, getComponentForm, getDelay, getHeight, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPosition, getPreferredSize, getRepetitionMode, getScrollAnimationSpeed, getScrollX, getScrollY, getSideGap, getStyle, getUIID, getWidth, getX, getY, handlesInput, hasFocus, initialize, isEnabled, isFocusable, isFocusPainted, isInitialized, isRunning, isScrollableX, isScrollVisible, isSmoothScrolling, isVisible, jumpTo, keyRepeated, longKeyPress, paintBackgrounds, paintComponent, paintComponent, pointerDragged, pointerPressed, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, setAnimationMode, setCellRenderer, setDelay, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredSize, setRepetitionMode, setScrollAnimationSpeed, setScrollX, setScrollY, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setStyle, setUIID, setVisible, setWidth, setX, setY, start, stop, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY

public static final int ANY
Allows any type of input into a text field, if a constraint is not supported by an underlying implementation this will be the default.

See Also:
Constant Field Values

EMAILADDR

public static final int EMAILADDR
The user is allowed to enter an e-mail address.

See Also:
Constant Field Values

NUMERIC

public static final int NUMERIC
The user is allowed to enter only an integer value.

See Also:
Constant Field Values

PHONENUMBER

public static final int PHONENUMBER
The user is allowed to enter a phone number.

See Also:
Constant Field Values

URL

public static final int URL
The user is allowed to enter a URL.

See Also:
Constant Field Values

DECIMAL

public static final int DECIMAL
The user is allowed to enter numeric values with optional decimal fractions, for example "-123", "0.123", or ".5".

See Also:
Constant Field Values

PASSWORD

public static final int PASSWORD
Indicates that the text entered is confidential data that should be obscured whenever possible.

See Also:
Constant Field Values

UNEDITABLE

public static final int UNEDITABLE
Indicates that editing is currently disallowed.

See Also:
Constant Field Values

SENSITIVE

public static final int SENSITIVE
Indicates that the text entered is sensitive data that the implementation must never store into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes.

See Also:
Constant Field Values

NON_PREDICTIVE

public static final int NON_PREDICTIVE
Indicates that the text entered does not consist of words that are likely to be found in dictionaries typically used by predictive input schemes.

See Also:
Constant Field Values

INITIAL_CAPS_WORD

public static final int INITIAL_CAPS_WORD
This flag is a hint to the implementation that during text editing, the initial letter of each word should be capitalized.

See Also:
Constant Field Values

INITIAL_CAPS_SENTENCE

public static final int INITIAL_CAPS_SENTENCE
This flag is a hint to the implementation that during text editing, the initial letter of each sentence should be capitalized.

See Also:
Constant Field Values
Constructor Detail

TextArea

public TextArea(int rows,
                int columns)
Creates an area with the given rows and columns.

Parameters:
rows - the number of rows
columns - - the number of columns

TextArea

public TextArea(int rows,
                int columns,
                int constraint)
Creates an area with the given rows, columns and constraint.

Parameters:
rows - the number of rows
columns - - the number of columns
constraint - one of ANY, EMAILADDR, NUMERIC, PHONENUMBER, URL, DECIMAL it can be bitwise or'd with one of PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD. E.g. ANY | PASSWORD.

TextArea

public TextArea(String text,
                int rows,
                int columns)
Creates an area with the given text, rows and columns.

Parameters:
text - the text to be displayed; if text is null, the empty string "" will be displayed
rows - the number of rows
columns - - the number of columns

TextArea

public TextArea(String text,
                int rows,
                int columns,
                int constraint)
Creates an area with the given text, rows, columns and constraint.

Parameters:
text - the text to be displayed; if text is null, the empty string "" will be displayed
rows - the number of rows
columns - - the number of columns
constraint - one of ANY, EMAILADDR, NUMERIC, PHONENUMBER, URL, DECIMAL it can be bitwise or'd with one of PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD. E.g. ANY | PASSWORD.

TextArea

public TextArea(String text,
                int maxSize)
Creates an area with the given text and maximum size, this constructor will create a single line text area similar to a text field!

Parameters:
text - the text to be displayed; if text is null, the empty string "" will be displayed
maxSize - text area maximum size

TextArea

public TextArea(String text)
Creates an area with the given text, this constructor will create a single line text area similar to a text field!

Parameters:
text - the text to be displayed; if text is null, the empty string "" will be displayed

TextArea

public TextArea()
Creates an empty text area, this constructor will create a single line text area similar to a text field!

Method Detail

setConstraint

public void setConstraint(int constraint)
Sets the constraint.

Parameters:
constraint - one of ANY, EMAILADDR, NUMERIC, PHONENUMBER, URL, DECIMAL it can be bitwise or'd with one of PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD. E.g. ANY | PASSWORD.
See Also:
getConstraint()

getConstraint

public int getConstraint()
Returns the editing constraint value.

Returns:
the editing constraint value
See Also:
setConstraint(int)

setText

public void setText(String t)
Sets the text within this text area.

Parameters:
t - new value for the text area
See Also:
getText()

getText

public String getText()
Returns the text in the text area.

Returns:
the text in the text area
See Also:
setText(java.lang.String)

isEditable

public boolean isEditable()
Returns true if this area is editable.

Returns:
true if this area is editable

setEditable

public void setEditable(boolean b)
Sets this text area to be editable or readonly.

Parameters:
b - true is text are is editable; otherwise false

getMaxSize

public int getMaxSize()
Returns the maximum size for the text area.

Returns:
the maximum size for the text area
See Also:
setMaxSize(int)

setMaxSize

public void setMaxSize(int maxSize)
Sets the maximum size of the text area.

Parameters:
maxSize - the maximum size of the text area
See Also:
getMaxSize()

keyPressed

public void keyPressed(int keyCode)
Description copied from class: Component
If this Component is focused, the key pressed event will call this method.

Overrides:
keyPressed in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

keyReleased

public void keyReleased(int keyCode)
Description copied from class: Component
If this Component is focused, the key released event will call this method.

Overrides:
keyReleased in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

isScrollableY

public boolean isScrollableY()
Description copied from class: Component
Indicates whether the component should/could scroll on the Y axis.

Overrides:
isScrollableY in class Component
Returns:
whether the component is scrollable on the X axis

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method.

Overrides:
pointerReleased in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

getColumns

public int getColumns()
Returns the number of columns in the text area.

Returns:
the number of columns in the text area
See Also:
setColumns(int)

getRows

public int getRows()
Returns the number of rows in the text area.

Returns:
the number of rows in the text area
See Also:
setRows(int)

setColumns

public void setColumns(int columns)
Sets the number of columns in the text area.

Parameters:
columns - number of columns
See Also:
getColumns()

setRows

public void setRows(int rows)
Sets the number of rows in the text area.

Parameters:
rows - number of rows
See Also:
getRows()

getLines

public int getLines()
Returns the number of text lines in the TextArea.

Returns:
the number of text lines in the TextArea

getTextAt

public String getTextAt(int line)
Returns the text at the given row of the text box.

Parameters:
line - the line number in the text box
Returns:
the text at the given row

getRowsGap

public int getRowsGap()
Gets the num of pixels gap between the rows.

Returns:
the gap between rows in pixels
See Also:
setRowsGap(int)

setRowsGap

public void setRowsGap(int rowsGap)
The gap in pixels between rows.

Parameters:
rowsGap - num of pixels to gap between rows
See Also:
getRowsGap()

paint

public void paint(Graphics g)
Description copied from class: Component
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

Specified by:
paint in interface Animation
Overrides:
paint in class Component
Parameters:
g - the component graphics

addActionListener

public void addActionListener(ActionListener a)
Add an action listener which is invoked when the text area was modified not during modification. A text field might never fire an action event if it is edited in place and the user never leaves the text field!

Parameters:
a - actionListener
See Also:
removeActionListener(com.sun.dtv.lwuit.events.ActionListener)

removeActionListener

public void removeActionListener(ActionListener a)
Removes an action listener.

Parameters:
a - actionListener
See Also:
addActionListener(com.sun.dtv.lwuit.events.ActionListener)

setDefaultMaxSize

public static void setDefaultMaxSize(int value)
Sets the default limit for the native text box size.

Parameters:
value - default value for the size of the native text box

isGrowByContent

public boolean isGrowByContent()
Indicates that the text area should "grow" in height based on the content beyond the limits indicate by the rows variable.

Returns:
true if the text component should grow and false otherwise

setGrowByContent

public void setGrowByContent(boolean growByContent)
Indicates that the text area should "grow" in height based on the content beyond the limits indicate by the rows variable.

Parameters:
growByContent - true if the text component should grow and false otherwise

setAutoDegradeMaxSize

public static void setAutoDegradeMaxSize(boolean value)
Indicates whether a high value for default maxSize will be reduced to a lower value if the underlying platform throws an exception.

Parameters:
value - if true then the platform will auto degrade.

isAutoDegradeMaxSize

public static boolean isAutoDegradeMaxSize()
Indicates whether a high value for default maxSize will be reduced to a lower value if the underlying platform throws an exception.

Returns:
the current setting for auto degrade.

getUnsupportedChars

public String getUnsupportedChars()
Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts. The rendering engine can thus remove them when drawing.

Returns:
String containing the unsupported characters
See Also:
setUnsupportedChars(java.lang.String)

setUnsupportedChars

public void setUnsupportedChars(String unsupportedChars)
Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts. The rendering engine can thus remove them when drawing.

Parameters:
unsupportedChars - String containing the unsupported characters
See Also:
getUnsupportedChars()

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.