public interface TextHandler extends ComponentHandler<String>
A specialized ComponentHandler
implementation for text components.
This handler class provides some extended functionality specific for text input components. Examples of this functionality include methods for querying or manipulating the text field's selection or support for clipboard operations. Using this handler interface applications gain more control of text components.
Modifier and Type | Method and Description |
---|---|
void |
clearSelection()
Clears the selection of the text component.
|
void |
copy()
Copies the currently selected text to the system clipboard.
|
void |
cut()
Cuts the currently selected text and copies it into the system clipboard.
|
String |
getSelectedText()
Returns the currently selected text.
|
int |
getSelectionEnd()
Returns the end index of the current selection in the text field.
|
int |
getSelectionStart()
Returns the start index of the current selection in the text field.
|
boolean |
hasSelection()
Returns a flag whether the text component has a non-empty selection.
|
void |
paste()
Pastes the content of the system clipboard into this text component.
|
void |
replaceSelectedText(String text)
Replaces the text currently selected by the specified string.
|
void |
select(int start,
int end)
Sets the selection of the text field.
|
void |
selectAll()
Selects all text contained in the text component.
|
getComponent, getData, getOuterComponent, getType, isEnabled, setData, setEnabled
boolean hasSelection()
int getSelectionStart()
hasSelection()
returns true.int getSelectionEnd()
hasSelection()
returns true.void select(int start, int end)
start
- the start index of the selectionend
- the end index of the selectionvoid selectAll()
void clearSelection()
String getSelectedText()
hasSelection()
returns
true.void replaceSelectedText(String text)
text
- the replacement textvoid copy()
void cut()
void paste()
Copyright © 2016 The JGUIraffe Team. All rights reserved.