com.bluemarsh.jswat.view
Class SelectionDrawLayer
java.lang.Object
|
+--com.bluemarsh.jswat.view.BasicDrawLayer
|
+--com.bluemarsh.jswat.view.HighlightDrawLayer
|
+--com.bluemarsh.jswat.view.SelectionDrawLayer
- All Implemented Interfaces:
- DrawLayer
- public class SelectionDrawLayer
- extends HighlightDrawLayer
SelectionDrawLayer is responsible for showing the current text
selection in the text area. It also keeps track of the current
text selection.
- Author:
- Nathan Fiedler
Field Summary |
protected static java.awt.Color |
selectionColor
Color used to indicate selection. |
Constructor Summary |
SelectionDrawLayer()
Constructs a SelectionDrawLayer using the default color. |
Method Summary |
int |
getSelectionEnd()
Returns the selected text's end position. |
int |
getSelectionStart()
Returns the selected text's start position. |
void |
setSelection(int start,
int end)
Selects the text found between the specified start and end
locations. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
selectionColor
protected static java.awt.Color selectionColor
- Color used to indicate selection.
SelectionDrawLayer
public SelectionDrawLayer()
- Constructs a SelectionDrawLayer using the default color.
getSelectionEnd
public int getSelectionEnd()
- Returns the selected text's end position. Return 0 if the document
is empty, or the value of dot if there is no selection.
- Returns:
- the end position >= 0
getSelectionStart
public int getSelectionStart()
- Returns the selected text's start position. Return 0 if the document
is empty, or the value of dot if there is no selection.
- Returns:
- the start position >= 0
setSelection
public void setSelection(int start,
int end)
- Selects the text found between the specified start and end
locations. If the start location is after the end location,
the values will be swapped before the selection is made.
- Parameters:
start
- start offset of the selection.end
- end offset of the selection.