Package java.awt Previous
Previous
Java API
Java API
Index
Index
Next
Next

Class TextComponent

Methods

public  class  java.awt.TextComponent
    extends  java.awt.Component  
{
        // Methods
    public String getSelectedText();	
    public int getSelectionEnd();	
    public int getSelectionStart();	
    public String getText();	
    public boolean isEditable();	
    protected String paramString();	
    public void removeNotify();	
    public void select(int  selStart, int  selEnd);	
    public void selectAll();	
    public void setEditable(boolean  t);	
    public void setText(String  t);	
}

A text component is the superclass of any component that allows the editing of some text.


Methods


getSelectedText

public String getSelectedText() 

Return Value:

Returns the selected text in this text component.

See Also: setText .


getSelectionEnd

public int getSelectionEnd() 

Return Value:

Returns selected text's end position in this text component.


getSelectionStart

public int getSelectionStart() 

Return Value:

Returns the selected text's start position in this text component.


getText

public String getText() 

Return Value:

Returns the text of this text component.

See Also: setText .


isEditable

public boolean isEditable() 

Return Value:

Returns true if this text component is editable; false otherwise.

See Also: setEditable .


paramString

protected String paramString() 

Returns the parameter string representing the state of this text component. This string is useful for debugging.

Return Value:

Returns the parameter string of this text component.

Overrides:

paramString in class Component .


removeNotify

public void removeNotify() 

Notifies this text component to destroy its peer.

Overrides:

removeNotify in class Component .


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).

ParameterDescription
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.

ParameterDescription
t a flag indicating whether the text component should become user editable

See Also: isEditable .


setText

public void setText(String  t) 

Sets the text of this text component to be the specified text.

ParameterDescription
t the new text

See Also: getText .



Top© 1996 Sun Microsystems, Inc. All rights reserved.