Top Description Inners Methods
javax.swing.text

public Interface Position

Known Direct Implementers
javax.swing.text.StringContent.StickyPosition, javax.swing.text.GapContent.StickyPosition

Represents a location within a document. It is intended to abstract away implementation details of the document and enable specification of positions within the document that are capable of tracking of change as the document is edited.

A Position object points at a location between two characters. As the surrounding content is altered, the Position object adjusts its offset automatically to reflect the changes. If content is inserted or removed before the Position object's location, then the Position increments or decrements its offset, respectively, so as to point to the same location. If a portion of the document is removed that contains a Position's offset, then the Position's offset becomes that of the beginning of the removed region. For example, if a Position has an offset of 5 and the region 2-10 is removed, then the Position's offset becomes 2.

Position with an offset of 0 is a special case. It never changes its offset while document content is altered.

Author
Timothy Prinzing

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Position.Bias

A typesafe enumeration to indicate bias to a position in the model.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the offset >= 0
getOffset
()

Fetches the current offset within the document.

Method Detail

getOffsetback to summary
public int getOffset()

Fetches the current offset within the document.

Returns:int

the offset >= 0

javax.swing.text back to summary

public final Class Position.Bias

extends Object
Class Inheritance

A typesafe enumeration to indicate bias to a position in the model. A position indicates a location between two characters. The bias can be used to indicate an interest toward one of the two sides of the position in boundary conditions where a simple offset is ambiguous.

Field Summary

Modifier and TypeField and Description
public static final Position.Bias
Backward

Indicates a bias toward the previous character in the model.

public static final Position.Bias
Forward

Indicates to bias toward the next character in the model.

private String

Constructor Summary

AccessConstructor and Description
private
Bias(String name)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

string representation
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

Backwardback to summary
public static final Position.Bias Backward

Indicates a bias toward the previous character in the model.

Forwardback to summary
public static final Position.Bias Forward

Indicates to bias toward the next character in the model.

nameback to summary
private String name

Constructor Detail

Biasback to summary
private Bias(String name)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

string representation

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object