public class TextMark extends Object
 TextIters are transient pointers to positions within TextBuffers which are
 invalidated when their TextBuffer is modified, so you can't "save" them. If
 you need to preserve a position for later reuse, then get a TextMark by
 calling TextBuffer's createMark() on it.
 
 
 There are two "standard" TextMarks available in all TextBuffers, relating
 to the cursor and the current selection. See getInsert() and getSelectionBound().
 
 
 Instances of this class fill the same role for TextBuffers that
 TreeRowReference does in providing stability for rows pointed to
 transiently by TreeIters that come from TreeModels.
| Modifier and Type | Field and Description | 
|---|---|
static boolean | 
LEFT
Left-gravity. 
 | 
static boolean | 
RIGHT
Right-gravity. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
TextBuffer | 
getBuffer()
Get the TextBuffer that this TextMark points into. 
 | 
TextIter | 
getIter()
Get a currently valid TextIter indicating where in the TextBuffer this
 TextMark is pointing. 
 | 
public static final boolean LEFT
createMark(). The
 TextMark will stay fixed to the left if text is added there.public static final boolean RIGHT
createMark(). The
 TextMark will move to the right if text is added there. The
 insert TextMark (your cursor) has right-gravity.public TextBuffer getBuffer()
public TextIter getIter()
 The usual caveats about changes invalidating iterators apply, but if
 you use these inline you will have no problems. For example, given
 TextMarks start, end and a TextTag of some
 sort, you could easily do:
 
 
buffer.applyTag(bold, start.getIter(), end.getIter());which is very straight forward. If you are using the same position repeatedly, however, and not changing the TextBuffer, then it is far more efficient to convert the TextMark into a TextIter once and use that directly.