public class Utilities extends Object
| Constructor and Description |
|---|
Utilities()
|
| Modifier and Type | Method and Description |
|---|---|
static int |
drawTabbedText(Segment
Draws the given text, expanding any tabs that are contained using the given tab expansion technique.
|
static int |
getBreakLocation(Segment
Determine where to break the given text to fit within the given span.
|
static int |
getNextWord(JTextComponent
Determines the start of the next word for the given location.
|
static Element |
getParagraphElement(JTextComponent
Determines the element to use for a paragraph/line.
|
static int |
getPositionAbove(JTextComponent
Determines the position in the model that is closest to the given view location in the row above.
|
static int |
getPositionBelow(JTextComponent
Determines the position in the model that is closest to the given view location in the row below.
|
static int |
getPreviousWord(JTextComponent
Determine the start of the prev word for the given location.
|
static int |
getRowEnd(JTextComponent
Determines the ending row model position of the row that contains the specified model position.
|
static int |
getRowStart(JTextComponent
Determines the starting row model position of the row that contains the specified model position.
|
static int |
getTabbedTextOffset(Segment
Determines the relative offset into the given text that best represents the given span in the view coordinate system.
|
static int |
getTabbedTextOffset(Segment
|
static int |
getTabbedTextWidth(Segment
Determines the width of the given segment of text taking tabs into consideration.
|
static int |
getWordEnd(JTextComponent
Determines the end of a word for the given location.
|
static int |
getWordStart(JTextComponent
Determines the start of a word for the given model location.
|
public static final int drawTabbedText(Segments, int x, int y, Graphics g, TabExpander e, int startOffset)
s - the source of the text
x - the X origin >= 0
y - the Y origin >= 0
g - the graphics context
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 getTabbedTextWidth(Segments, FontMetrics metrics, int x, TabExpander e, int startOffset)
s - the source of the text
metrics - the font metrics to use for the calculation
x - the X origin >= 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(Segments, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s - the source of the text
metrics - the font metrics to use for the calculation
x0 - 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(Segments, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset, boolean round)
public static final int getBreakLocation(Segments, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
s - the source of the text
metrics - the font metrics to use for the calculation
x0 - 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(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final int getRowEnd(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final int getPositionAbove(JTextComponentc, int offs, int x) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
x - the X coordinate >= 0
BadLocationException - if the offset is out of range
public static final int getPositionBelow(JTextComponentc, int offs, int x) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
x - the X coordinate >= 0
BadLocationException - if the offset is out of range
public static final int getWordStart(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final int getWordEnd(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final int getNextWord(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final int getPreviousWord(JTextComponentc, int offs) throws BadLocationException
c - the editor
offs - the offset in the document >= 0
BadLocationException - if the offset is out of range
public static final ElementgetParagraphElement(JTextComponent c, int offs)
c - the editor
offs - the starting offset in the document >= 0