|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.Utilities
Safe: A collection of methods to deal with various text related activities.
Constructor Summary | |
Utilities()
Enabled: |
Method Summary | |
(package private) static int |
drawComposedText(AttributeSet attr,
Graphics g,
int x,
int y,
int p0,
int p1)
Draws the given composed text passed from an input method. |
static int |
drawTabbedText(Segment s,
int x,
int y,
Graphics g,
TabExpander e,
int startOffset)
Enabled: Draws the given text, expanding any tabs that are contained using the given tab expansion technique. |
static int |
getBreakLocation(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset)
Enabled: Determine where to break the given text to fit within the the given span. |
(package private) static int |
getNextVisualPositionFrom(View v,
int pos,
javax.swing.text.Position.Bias b,
Shape alloc,
int direction,
javax.swing.text.Position.Bias[] biasRet)
Provides a way to determine the next visually represented model location that one might place a caret. |
static int |
getNextWord(JTextComponent c,
int offs)
Enabled: Determines the start of the next word for the given location. |
(package private) static int |
getNextWordInParagraph(JTextComponent c,
Element line,
int offs,
boolean first)
Finds the next word in the given elements text. |
static Element |
getParagraphElement(JTextComponent c,
int offs)
Enabled: Determines the element to use for a paragraph/line. |
static int |
getPositionAbove(JTextComponent c,
int offs,
int x)
Enabled: Determines the position in the model that is closest to the given view location in the row above. |
static int |
getPositionBelow(JTextComponent c,
int offs,
int x)
Enabled: Determines the position in the model that is closest to the given view location in the row below. |
static int |
getPreviousWord(JTextComponent c,
int offs)
Enabled: Determine the start of the prev word for the given location. |
(package private) static int |
getPrevWordInParagraph(JTextComponent c,
Element line,
int offs)
Finds the previous word in the given elements text. |
static int |
getRowEnd(JTextComponent c,
int offs)
Enabled: Determines the ending row model position of the row that contains the specified model position. |
static int |
getRowStart(JTextComponent c,
int offs)
Enabled: Determines the starting row model position of the row that contains the specified model position. |
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset)
Enabled: Determines the relative offset into the given text that best represents the given span in the view coordinate system. |
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset,
boolean round)
Enabled: |
static int |
getTabbedTextWidth(Segment s,
FontMetrics metrics,
int x,
TabExpander e,
int startOffset)
Enabled: Determines the width of the given segment of text taking tabs into consideration. |
static int |
getWordEnd(JTextComponent c,
int offs)
Enabled: Determines the end of a word for the given location. |
static int |
getWordStart(JTextComponent c,
int offs)
Enabled: Determines the start of a word for the given model location. |
(package private) static boolean |
isComposedTextAttributeDefined(AttributeSet as)
|
(package private) static boolean |
isComposedTextElement(Element elem)
|
(package private) static boolean |
isLeftToRight(Component c)
|
(package private) static void |
paintComposedText(Graphics g,
Rectangle alloc,
GlyphView v)
Paints the composed text in a GlyphView |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Utilities()
Method Detail |
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset)
s
- the source of the textx
- the X origin >= 0y
- the Y origin >= 0g
- the graphics contexte
- how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset
- starting offset of the text in the document >= 0
public static final int getTabbedTextWidth(Segment s, FontMetrics metrics, int x, TabExpander e, int startOffset)
s
- the source of the textmetrics
- the font metrics to use for the calculationx
- the X origin >= 0e
- how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset
- starting offset of the text in the document >= 0
public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s
- the source of the textmetrics
- the font metrics to use for the calculationx0
- the starting view location representing the start
of the given text >= 0.x
- the target view location to translate to an
offset into the text >= 0.e
- how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset
- starting offset of the text in the document >= 0
public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset, boolean round)
public static final int getBreakLocation(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s
- the source of the textmetrics
- the font metrics to use for the calculationx0
- the starting view location representing the start
of the given text.x
- the target view location to translate to an
offset into the text.e
- how to expand the tabs. If this value is null,
tabs will be expanded as a space character.startOffset
- starting offset in the document of the text
public static final int getRowStart(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
public static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
public static final int getPositionAbove(JTextComponent c, int offs, int x) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0x
- the X coordinate >= 0
BadLocationException
public static final int getPositionBelow(JTextComponent c, int offs, int x) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0x
- the X coordinate >= 0
BadLocationException
public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
public static final int getNextWord(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
static int getNextWordInParagraph(JTextComponent c, Element line, int offs, boolean first) throws BadLocationException
BadLocationException
public static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
BadLocationException
static int getPrevWordInParagraph(JTextComponent c, Element line, int offs) throws BadLocationException
BadLocationException
public static final Element getParagraphElement(JTextComponent c, int offs)
c
- the editoroffs
- the starting offset in the document >= 0
static boolean isComposedTextElement(Element elem)
static boolean isComposedTextAttributeDefined(AttributeSet as)
static int drawComposedText(AttributeSet attr, Graphics g, int x, int y, int p0, int p1) throws BadLocationException
attr
- the attributes containing the composed textg
- the graphics contextx
- the X originy
- the Y originp0
- starting offset in the composed text to be renderedp1
- ending offset in the composed text to be rendered
BadLocationException
static void paintComposedText(Graphics g, Rectangle alloc, GlyphView v)
static boolean isLeftToRight(Component c)
static int getNextVisualPositionFrom(View v, int pos, javax.swing.text.Position.Bias b, Shape alloc, int direction, javax.swing.text.Position.Bias[] biasRet) throws BadLocationException
This implementation assumes the views are layed out in a logical
manner. That is, that the view at index x + 1 is visually after
the View at index x, and that the View at index x - 1 is visually
before the View at x. There is support for reversing this behavior
only if the passed in View
is an instance of
CompositeView
. The CompositeView
must then override the flipEastAndWestAtEnds
method.
v
- View to querypos
- the position to convert >= 0direction
- the direction from the current position that can
be thought of as the arrow keys typically found on a keyboard;
this may be one of the following:
SwingConstants.WEST
SwingConstants.EAST
SwingConstants.NORTH
SwingConstants.SOUTH
biasRet
- an array contain the bias that was checked
BadLocationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |