buoy.widget
Class TextWidget
public abstract class TextWidget
A TextWidget is a Widget that allows the user to view and edit text. This is an abstract class.
Subclasses implement specific types of text editing Widgets
int | getCaretPosition() - Get the current position of the caret.
|
int | getLength() - Get the number of characters in the text contained in the Widget.
|
String | getSelectedText() - Get the selected text.
|
int | getSelectionEnd() - Get the end of the selected range.
|
int | getSelectionStart() - Get the start of the selected range.
|
String | getText() - Get the text contained in the Widget.
|
boolean | isEditable() - Determine whether the user can edit the text contained in this text field.
|
void | setCaretPosition(int pos) - Set the current position of the caret.
|
void | setEditable(boolean editable) - Set whether the user can edit the text contained in this text field.
|
void | setSelectionEnd(int pos) - Set the end of the selected range.
|
void | setSelectionStart(int pos) - Set the start of the selected range.
|
void | setText(String text) - Set the text contained in the Widget.
|
addEventLink , dispatchEvent , getBackground , getBounds , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
getCaretPosition
public int getCaretPosition()
Get the current position of the caret.
getLength
public int getLength()
Get the number of characters in the text contained in the Widget.
getSelectedText
public String getSelectedText()
Get the selected text. This returns null if no text is currently selected.
getSelectionEnd
public int getSelectionEnd()
Get the end of the selected range. This is the index of the first character after the end
of the selection.
getSelectionStart
public int getSelectionStart()
Get the start of the selected range. This is the index of the first selected character.
getText
public String getText()
Get the text contained in the Widget.
isEditable
public boolean isEditable()
Determine whether the user can edit the text contained in this text field.
setCaretPosition
public void setCaretPosition(int pos)
Set the current position of the caret.
setEditable
public void setEditable(boolean editable)
Set whether the user can edit the text contained in this text field.
setSelectionEnd
public void setSelectionEnd(int pos)
Set the end of the selected range. This is the index of the first character after the end
of the selection.
setSelectionStart
public void setSelectionStart(int pos)
Set the start of the selected range. This is the index of the first selected character.
setText
public void setText(String text)
Set the text contained in the Widget.
This method can be safely called from any thread, not just the event dispatch thread.
Written by Peter Eastman.