public class SelectableTextSelectionDelegate extends Object implements SelectionDelegate
From the HTML5 spec:
Mostly for historical reasons, in addition to the browsing context's selection, each textarea and input element has an independent selection. These are the text field selections.
| Constructor and Description |
|---|
SelectableTextSelectionDelegate(SelectableTextInput element)
Creates a new instance for the specified element.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getSelectedText()
Returns the selected text in the owner element, or
null if there is no selected text. |
int |
getSelectionEnd()
Returns the end position of the selected text in the owner element.
|
int |
getSelectionStart()
Returns the start position of the selected text in the owner element.
|
void |
select()
Focuses the owner element and selects all of its text.
|
void |
setSelectionEnd(int selectionEnd)
Sets the end position of the selected text in the owner element.
|
void |
setSelectionStart(int selectionStart)
Sets the start position of the selected text in the owner element.
|
public SelectableTextSelectionDelegate(SelectableTextInput element)
element - the owner elementpublic void select()
public String getSelectedText()
null if there is no selected text.null if there is no selected textpublic int getSelectionStart()
getSelectionStart in interface SelectionDelegatepublic void setSelectionStart(int selectionStart)
setSelectionStart in interface SelectionDelegateselectionStart - the start position of the selected text in the owner elementpublic int getSelectionEnd()
getSelectionEnd in interface SelectionDelegatepublic void setSelectionEnd(int selectionEnd)
setSelectionEnd in interface SelectionDelegateselectionEnd - the end position of the selected text in the owner elementCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.