com.sun.lwuit
Class TextArea

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.TextArea
All Implemented Interfaces:
Animation, StyleListener
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.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
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(java.lang.String text)
          Creates an area with the given text, this constructor will create a single line text area similar to a text field!
TextArea(java.lang.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(java.lang.String text, int rows, int columns)
          Creates an area with the given text, rows and columns
TextArea(java.lang.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.
static void autoDetectWidestChar(java.lang.String s)
          Searches the given string for the widest character using char width, this operation should only be performed once and it solves cases where a devices language might have a char bigger than 'W' that isn't consistently bigger.
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
protected  Dimension calcScrollSize()
          Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport
protected  void fireClicked()
          When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly.
 int getAbsoluteAlignment()
          Deprecated. this method is redundant and no longer used
 int getActualRows()
          Returns the number of actual rows in the text area taking into consideration growsByContent
 int getAlignment()
          Deprecated. use Style.getAlignment instead
 int getColumns()
          Returns the number of columns in the text area
 int getConstraint()
          Returns the editing constraint value
 int getCursorPosition()
          Returns the position of the cursor char position
 int getCursorX()
          Returns the position of the cursor char position in the current line.
 int getCursorY()
          Returns the position of the cursor line position
static int getDefaultValign()
          Indicates the defaut vertical alignment for a text field, only applies to single line text fields
 java.lang.String getHint()
          Returns the hint text
 Image getHintIcon()
          Returns the hint icon
 java.lang.String getInputMode()
          Returns the currently selected input mode
 java.lang.String[] getInputModeOrder()
          Returns the order in which input modes are toggled
 int getLines()
          Returns the number of text lines in the TextArea
 int getLinesToScroll()
          Indicates the number of lines to scroll with every scroll operation
 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
 java.lang.String getText()
          Returns the text in the text area
 java.lang.String getTextAt(int line)
          Returns the text in the given row of the text box
 java.lang.String getUnsupportedChars()
          Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts.
 int getVerticalAlignment()
          Returns the vertical alignment of the text field, this only applies to single line text field
static char getWidestChar()
          Indicates the widest character in the alphabet, this is useful for detecting linebreaks internally.
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 isEnableInputScroll()
          Indicates whether text field input should scroll to the right side when no more room for the input is present.
protected  boolean isEnterKey(int keyCode)
          Indicates the enter key to be used for editing the text area and by the text field
 boolean isGrowByContent()
          Indicates that the text area should "grow" in height based on the content beyond the limits indicate by the rows variable
 boolean isPendingCommit()
          Returns true if the text field is waiting for a commit on editing
 boolean isQwertyInput()
          True is this is a qwerty device or a device that is currently in qwerty mode.
 boolean isScrollableY()
          Indicates whether the component should/could scroll on the Y axis
protected  boolean isSelectableInteraction()
          This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.
 boolean isSingleLineTextArea()
          Indicates whether this is a single line text area, in which case "growing" won't work as expected.
static boolean isUseStringWidth()
          By default text area uses charWidth since its much faster on some devices than string width.
 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 pointerHover(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerHoverReleased(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method
protected  char[] preprocess(java.lang.String text)
          Override this to modify the text for rendering in cases of invalid characters for display, this method allows the developer to replace such characters e.g.: replace "\\t" with 4 spaces
 void removeActionListener(ActionListener a)
          Removes an action listener
 void setAlignment(int align)
          Deprecated. use Style.setAlignment instead
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
static void setDefaultValign(int aDefaultValign)
          Indicates the defaut vertical alignment for a text field, only applies to single line text fields
 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 setHint(java.lang.String hint)
          Sets the TextArea hint text, the hint text is displayed on the TextArea When there is no text in the TextArea
 void setHint(java.lang.String hint, Image icon)
          Sets the TextArea hint text and Icon, the hint text and icon are displayed on the TextArea when there is no text in the TextArea
 void setHintIcon(Image icon)
          Sets the TextArea hint icon, the hint is displayed on the TextArea When there is no text in the TextArea
 void setLinesToScroll(int linesToScroll)
          Indicates the number of lines to scroll with every scroll operation
 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 setSingleLineTextArea(boolean singleLineTextArea)
          Indicates whether this is a single line text area, in which case "growing" won't work as expected.
 void setText(java.lang.String t)
          Sets the text within this text area
 void setUnsupportedChars(java.lang.String unsupportedChars)
          Unsupported characters is a string that contains characters that cause issues when rendering on some problematic fonts.
static void setUseStringWidth(boolean aUseStringWidth)
          By default text area uses charWidth since its much faster on some devices than string width.
 void setVerticalAlignment(int valign)
          Sets the vertical alignment of the text field to one of: CENTER, TOP, BOTTOM
only applies to single line text field
static void setWidestChar(char widestC)
          Indicates the widest character in the alphabet, this is useful for detecting linebreaks internally.
 void setWidth(int width)
          Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.
If a user wishes to effect the component size setPreferredSize should be used.
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, animate, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollableX, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, paramString, pointerDragged, pointerDragged, pointerHoverPressed, pointerPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, 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
Throws:
java.lang.IllegalArgumentException - if rows <= 0 or columns <= 1

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 bitwised or'd with one of PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD. E.g. ANY | PASSWORD.
Throws:
java.lang.IllegalArgumentException - if rows <= 0 or columns <= 1

TextArea

public TextArea(java.lang.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
Throws:
java.lang.IllegalArgumentException - if rows <= 0 or columns <= 1

TextArea

public TextArea(java.lang.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 bitwised or'd with one of PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD. E.g. ANY | PASSWORD.
Throws:
java.lang.IllegalArgumentException - if rows <= 0 or columns <= 1

TextArea

public TextArea(java.lang.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(java.lang.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

getDefaultValign

public static int getDefaultValign()
Indicates the defaut vertical alignment for a text field, only applies to single line text fields

Returns:
the defaultValign

setDefaultValign

public static void setDefaultValign(int aDefaultValign)
Indicates the defaut vertical alignment for a text field, only applies to single line text fields

Parameters:
aDefaultValign - the defaultValign to set

setConstraint

public void setConstraint(int constraint)
Sets the constraint

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

getConstraint

public int getConstraint()
Returns the editing constraint value

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

setWidth

public void setWidth(int width)
Description copied from class: Component
Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.
If a user wishes to effect the component size setPreferredSize should be used.

Overrides:
setWidth in class Component
Parameters:
width - the width of the component
See Also:
Component.setPreferredSize(com.sun.lwuit.geom.Dimension)

setText

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

Parameters:
t - new value for the text area

getText

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

Returns:
the text in the text area

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

setMaxSize

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

Parameters:
maxSize - the maximum size of the text area

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.

fireClicked

protected void fireClicked()
Description copied from class: Component
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly. When overriding this method you should also override isSelectableInteraction to indicate that a command is placed appropriately on top of the fire key for 3 soft button phones.

Overrides:
fireClicked in class Component

isSelectableInteraction

protected boolean isSelectableInteraction()
Description copied from class: Component
This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.

Overrides:
isSelectableInteraction in class Component
Returns:
true if this is a selectable interaction

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

pointerHover

public void pointerHover(int[] x,
                         int[] y)
Description copied from class: Component
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

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

pointerHoverReleased

public void pointerHoverReleased(int[] x,
                                 int[] y)
Description copied from class: Component
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

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

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

getActualRows

public int getActualRows()
Returns the number of actual rows in the text area taking into consideration growsByContent

Returns:
the number of rows in the text area

getRows

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

Returns:
the number of rows in the text area

setColumns

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

Parameters:
columns - number of columns

setRows

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

Parameters:
rows - number of rows

getLines

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

Returns:
the number of text lines in the TextArea

getTextAt

public java.lang.String getTextAt(int line)
Returns the text in the given row of the text box

Parameters:
line - the line number in the text box
Returns:
the text of the line

preprocess

protected char[] preprocess(java.lang.String text)
Override this to modify the text for rendering in cases of invalid characters for display, this method allows the developer to replace such characters e.g.: replace "\\t" with 4 spaces

Parameters:
text - the text to process
Returns:
the given string as a processed char array ready for rendering

getRowsGap

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

Returns:
the gap between rows in pixels

setRowsGap

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

Parameters:
rowsGap - num of pixels to gap between rows

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

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class Component
Returns:
the calculated preferred size based on component content

calcScrollSize

protected Dimension calcScrollSize()
Description copied from class: Component
Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport

Overrides:
calcScrollSize in class Component
Returns:
scroll size, by default this is the same as the preferred size

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

removeActionListener

public void removeActionListener(ActionListener a)
Removes an action listener

Parameters:
a - 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 - new value for autoDegradeMaxSize

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:
value for autoDegradeMaxSize

getUnsupportedChars

public java.lang.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:
unsupported characters string

setUnsupportedChars

public void setUnsupportedChars(java.lang.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 - the unsupported character string

getLinesToScroll

public int getLinesToScroll()
Indicates the number of lines to scroll with every scroll operation

Returns:
number bigger or equal to 1

setLinesToScroll

public void setLinesToScroll(int linesToScroll)
Indicates the number of lines to scroll with every scroll operation

Parameters:
linesToScroll - number bigger or equal to 1

setWidestChar

public static void setWidestChar(char widestC)
Indicates the widest character in the alphabet, this is useful for detecting linebreaks internally. In CJK languages the widest char is different than W hence this functionality is exposed to developers.

Parameters:
widestC - the widest character

getWidestChar

public static char getWidestChar()
Indicates the widest character in the alphabet, this is useful for detecting linebreaks internally. In CJK languages the widest char is different than W hence this functionality is exposed to developers.

Returns:
the widest character

setSingleLineTextArea

public void setSingleLineTextArea(boolean singleLineTextArea)
Indicates whether this is a single line text area, in which case "growing" won't work as expected.

Parameters:
singleLineTextArea - set to true to force a single line text

isSingleLineTextArea

public boolean isSingleLineTextArea()
Indicates whether this is a single line text area, in which case "growing" won't work as expected.

Returns:
true if this is a single line text area

setAlignment

public void setAlignment(int align)
Deprecated. use Style.setAlignment instead

Sets the Alignment of the TextArea to one of: CENTER, LEFT, RIGHT

Parameters:
align - alignment value
See Also:
Component.CENTER, Component.LEFT, Component.RIGHT

getAlignment

public int getAlignment()
Deprecated. use Style.getAlignment instead

Returns the alignment of the TextArea

Returns:
the alignment of the TextArea one of: CENTER, LEFT, RIGHT
See Also:
Component.CENTER, Component.LEFT, Component.RIGHT

getAbsoluteAlignment

public int getAbsoluteAlignment()
Deprecated. this method is redundant and no longer used

Returns the absolute alignment of the TextArea In RTL LEFT alignment is actually RIGHT, but this method returns the actual alignment

Returns:
the alignment of the TextArea one of: CENTER, LEFT, RIGHT
See Also:
Component.CENTER, Component.LEFT, Component.RIGHT

isPendingCommit

public boolean isPendingCommit()
Returns true if the text field is waiting for a commit on editing

Returns:
true if a commit is pending

getCursorPosition

public int getCursorPosition()
Returns the position of the cursor char position

Returns:
the cursor position

getCursorY

public int getCursorY()
Returns the position of the cursor line position

Returns:
the cursor line position

getCursorX

public int getCursorX()
Returns the position of the cursor char position in the current line.

Returns:
the cursor char position in the current line

isQwertyInput

public boolean isQwertyInput()
True is this is a qwerty device or a device that is currently in qwerty mode.

Returns:
currently defaults to false

getInputMode

public java.lang.String getInputMode()
Returns the currently selected input mode

Returns:
the display name of the input mode by default the following modes are supported: Abc, ABC, abc, 123

getInputModeOrder

public java.lang.String[] getInputModeOrder()
Returns the order in which input modes are toggled

Returns:
the order of the input modes

isEnableInputScroll

public boolean isEnableInputScroll()
Indicates whether text field input should scroll to the right side when no more room for the input is present.

Returns:
true if scrolling is enabled

isEnterKey

protected boolean isEnterKey(int keyCode)
Indicates the enter key to be used for editing the text area and by the text field

Parameters:
keyCode - the key tested

autoDetectWidestChar

public static void autoDetectWidestChar(java.lang.String s)
Searches the given string for the widest character using char width, this operation should only be performed once and it solves cases where a devices language might have a char bigger than 'W' that isn't consistently bigger. Notice that this method will use the TextArea style font which might differ when switching themes etc.

Parameters:
s - string to search using charWidth

isUseStringWidth

public static boolean isUseStringWidth()
By default text area uses charWidth since its much faster on some devices than string width. However, with some fonts and especially some languages (such as Arabic, Korean etc.) the width of the string drawn might not equal the summary of the width of the chars. Hence for portability to those languages/fonts this flag must be set to true.

Returns:
the value of useStringWidth

setUseStringWidth

public static void setUseStringWidth(boolean aUseStringWidth)
By default text area uses charWidth since its much faster on some devices than string width. However, with some fonts and especially some languages (such as Arabic, Korean etc.) the width of the string drawn might not equal the summary of the width of the chars. Hence for portability to those languages/fonts this flag must be set to true.

Parameters:
aUseStringWidth - the new value for useStringWidth

setHint

public void setHint(java.lang.String hint)
Sets the TextArea hint text, the hint text is displayed on the TextArea When there is no text in the TextArea

Parameters:
hint - the hint text to display

getHint

public java.lang.String getHint()
Returns the hint text

Returns:
the hint text or null

setHintIcon

public void setHintIcon(Image icon)
Sets the TextArea hint icon, the hint is displayed on the TextArea When there is no text in the TextArea

Parameters:
icon - the icon

getHintIcon

public Image getHintIcon()
Returns the hint icon

Returns:
the hint icon

setHint

public void setHint(java.lang.String hint,
                    Image icon)
Sets the TextArea hint text and Icon, the hint text and icon are displayed on the TextArea when there is no text in the TextArea

Parameters:
hint - the hint text to display
icon - the hint icon to display

setVerticalAlignment

public void setVerticalAlignment(int valign)
Sets the vertical alignment of the text field to one of: CENTER, TOP, BOTTOM
only applies to single line text field

Parameters:
valign - alignment value
See Also:
Component.CENTER, Component.TOP, Component.BOTTOM

getVerticalAlignment

public int getVerticalAlignment()
Returns the vertical alignment of the text field, this only applies to single line text field

Returns:
the vertical alignment of the TextField one of: CENTER, TOP, BOTTOM
See Also:
Component.CENTER, Component.TOP, Component.BOTTOM


Copyright 2011 Oracle Corporation. All rights reserved. Use is subject to license terms.