Packages This Package Prev Next Index
§1.39 Class TextComponent
public class java.awt.TextComponent
extends java.awt.Component (II-§1.10)
{
// Methods
public String getSelectedText(); §1.39.1
public int getSelectionEnd(); §1.39.2
public int getSelectionStart(); §1.39.3
public String getText(); §1.39.4
public boolean isEditable(); §1.39.5
protected String paramString(); §1.39.6
public void removeNotify(); §1.39.7
public void select(int selStart, int selEnd); §1.39.8
public void selectAll(); §1.39.9
public void setEditable(boolean t); §1.39.10
public void setText(String t); §1.39.11
}
A text component is the superclass of any component that allows the editing of some text.
getSelectedText
public String getSelectedText()
- Returns:
- the selected text in this text component.
- See Also:
- setText (II-§1.39.11).
getSelectionEnd
public int getSelectionEnd()
- Returns:
- selected text's end position in this text component.
getSelectionStart
public int getSelectionStart()
- Returns:
- the selected text's start position in this text component.
getText
public String getText()
- Returns:
- the text of this text component.
- See Also:
- setText (II-§1.39.11).
isEditable
public boolean isEditable()
- Returns:
- true if this text component is editable; false otherwise.
- See Also:
- setEditable (II-§1.39.10).
paramString
protected String paramString()
- Returns the parameter string representing the state of this text component.
This string is useful for debugging.
- Returns:
- the parameter string of this text component.
- Overrides:
- paramString in class Component (II-§1.10.51).
removeNotify
public void removeNotify()
- Notifies this text component to destroy its peer.
- Overrides:
- removeNotify in class Component (II-§1.10.58).
select
public void select(int selStart, int selEnd)
- Selects the text in this text component found from the specified start
(inclusive) index to the specified end index (exclusive).
- Parameters:
selStart
-
the start position of the text to select
selEnd
-
the end position of the text to select
selectAll
public void selectAll()
- Selects all the text in this text component.
setEditable
public void setEditable(boolean t)
- If the boolean argument is true, this text component becomes user editable.
If the flag is false, the user cannot change the text of this text component.
- Parameters:
t
-
a flag indicating whether the text component should become user
editable
- See Also:
- isEditable (II-§1.39.5).
setText
public void setText(String t)
- Sets the text of this text component to be the specified text.
- Parameters:
t
-
the new text
- See Also:
- getText (II-§1.39.4).
Packages This Package Prev Next Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc.
All rights reserved
Please send any comments or corrections to doug.kramer@sun.com