Interface NbDocument.PositionBiasable

All Superinterfaces:
Enclosing interface:

public static interface NbDocument.PositionBiasable
extends Document

Enhanced version of document that provides better support for holding and working with biased positions. It adds one new method createPosition(int, javax.swing.text.Position.Bias) that creates a position that moves either to the left or to the right when an insertion is performed at it.

If a document implements this interface, the new method is used in NbDocument.createPosition(javax.swing.text.Document, int, javax.swing.text.Position.Bias). If not, special support for the position is created.

Field Summary
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
Method Summary
 Position createPosition(int offset, Position.Bias bias)
          Creates position with a bias.
Methods inherited from interface javax.swing.text.Document
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render

Method Detail


public Position createPosition(int offset,
                               Position.Bias bias)
                        throws BadLocationException
Creates position with a bias. If the bias is Position.Bias.Backward then if an insert occures at the position, the text is inserted after the position. If the bias is Forward, then the text is inserted before the position.

offset - the offset for the position
bias - the bias to use for the position
BadLocationException - if the offset is invalid
See Also:
NbDocument.createPosition(javax.swing.text.Document, int, javax.swing.text.Position.Bias)


Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.