Methods Summary |
---|
public javax.swing.text.Segment | getSegment()Returns a Segment . When done, the Segment
should be recycled by invoking releaseSegment .
synchronized(this) {
int size = segments.size();
if (size > 0) {
return (Segment)segments.remove(size - 1);
}
}
return new CachedSegment();
|
public static javax.swing.text.SegmentCache | getSharedInstance()Returns the shared SegmentCache.
return sharedCache;
|
public static javax.swing.text.Segment | getSharedSegment()A convenience method to get a Segment from the shared
SegmentCache .
return getSharedInstance().getSegment();
|
public void | releaseSegment(javax.swing.text.Segment segment)Releases a Segment. You should not use a Segment after you release it,
and you should NEVER release the same Segment more than once, eg:
segmentCache.releaseSegment(segment);
segmentCache.releaseSegment(segment);
Will likely result in very bad things happening!
if (segment instanceof CachedSegment) {
synchronized(this) {
segment.array = null;
segment.count = 0;
segments.add(segment);
}
}
|
public static void | releaseSharedSegment(javax.swing.text.Segment segment)A convenience method to release a Segment to the shared
SegmentCache .
getSharedInstance().releaseSegment(segment);
|