Advanced   Java   Services
TextComponent, TextField, TextArea
Back Next Up Home

TextComponent


TextComponent ist die Basisklasse für TextField und TextArea und dient als Methodenlieferant für diese Klassen.

Methoden
ReturntypName der Methode
Eventhandling
void
 
 
addTextListener(TextListener l)
Adds the specified text event listener to receive text events from this text component.
void
 
 
removeTextListener(TextListener l)
Removes the specified text event listener so that it no longer receives text events from this text component If l is null, no exception is thrown and no action is performed.
TextListener[]
 
getTextListeners()
Returns an array of all the text listeners registered on this text component.
Textbearbeitung
int
 
getCaretPosition()
Gets the position of the text insertion caret for this text component.
void
 
setCaretPosition(int position)
Sets the position of the text insertion caret for this text component.
void
 
selectAll()
Selects all the text in this text component.
void
 
select(int selectionStart, int selectionEnd)
Selects the text between the specified start and end positions.
int
 
getSelectionStart()
Gets the start position of the selected text in this text component.
void
 
setSelectionStart(int selectionStart)
Sets the selection start for this text component to the specified position.
int
 
getSelectionEnd()
Gets the end position of the selected text in this text component.
void
 
setSelectionEnd(int selectionEnd)
Sets the selection end for this text component to the specified position.
String
 
getSelectedText()
Returns the selected text from the text that is presented by this text component.
String
 
getText()
Returns the text that is presented by this text component.
void
 
setText(String text)
Sets the text that is presented by this text component to be the specified text.
boolean
 
isEditable()
Indicates whether or not this text component is editable.
void
 
setEditable(boolean b)
Sets the flag that determines whether or not this text component is editable.


TextField


Konstruktoren
TextField()Constructs a new text field.
TextField(int columns) Constructs a new empty text field with the specified number of columns.
TextField(String text) Constructs a new text field initialized with the specified text.
TextField(String text, int columns) Constructs a new text field initialized with the specified text to be displayed, and wide enough to hold the specified number of columns.
Methoden
ReturntypName der Methode
Eventhandling
void
 
addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this text field.
void
 
removeActionListener(ActionListener l)
Removes the specified action listener so that it no longer receives action events from this text field.
ActionListener[]
 
getActionListeners()
Returns an array of all the action listeners registered on this textfield.
weitere Methoden
int
 
getColumns()
Gets the number of columns in this text field.
void
 
setColumns(int columns)
Sets the number of columns in this text field.
char
 
getEchoChar()
Gets the character that is to be used for echoing.
void
 
setEchoChar(char c)
Sets the echo character for this text field.
boolean
 
echoCharIsSet()
Indicates whether or not this text field has a character set for echoing.

Reaktion auf TextFelder

Ein TextFeld kann u.a. Actionereignisse und Textereignisse senden. Einzelheiten hierzu findet man im Kapitel Eventhandling.

TextArea


Konstanten
TypName der Konstante
static int
 
SCROLLBARS_BOTH
Create and display both vertical and horizontal scrollbars.
static int
 
SCROLLBARS_HORIZONTAL_ONLY
Create and display horizontal scrollbar only.
static int
 
SCROLLBARS_VERTICAL_ONLY
Create and display vertical scrollbar only.
static int
 
SCROLLBARS_NONE
Do not create or display any scrollbars for the text area.
Konstruktoren
TextArea() Constructs a new text area with the empty string as text.
TextArea(int rows, int columns)
 
Constructs a new text area with the specified number of rows and columns and the empty string as text.
TextArea(String text)
 
Constructs a new text area with the specified text.
TextArea(String text, int rows, int columns)
 
Constructs a new text area with the specified text, and with the specified number of rows and columns.
TextArea(String text, int rows, int columns, int scrollbars)
 
Constructs a new text area with the specified text, and with the rows, columns, and scroll bar visibility as specified.
Methoden
ReturntypName der Methode
Textbearbeitung
void
 
append(String str)
Appends the given text to the text area's current text.
void
 
insert(String str, int pos)
Inserts the specified text at the specified position in this text area.
void
 
replaceRange(String str, int start, int end)
Replaces text between the indicated start and end positions with the specified replacement text.
Erscheinung
int
 
getColumns()
Returns the number of columns in this text area.
void
 
setColumns(int columns)
Sets the number of columns for this text area.
int
 
getRows()
Returns the number of rows in the text area.
void
 
setRows(int rows)
Sets the number of rows for this text area.
int
 
getScrollbarVisibility()
Returns an enumerated value that indicates which scroll bars the text area uses.

Reaktion auf TextAreas

Eine TextArea kann u.a. Textereignisse senden. Einzelheiten hierzu findet man im Kapitel Eventhandling.

top Back Next Up Home