public class Utilities extends Object
Constructor | Description |
---|---|
Utilities() |
Modifier and Type | Method | Description |
---|---|---|
static float |
drawTabbedText(Segment s,
float x,
float y,
Graphics2D g,
TabExpander e,
int startOffset) |
Draws the given text, expanding any tabs that are contained
using the given tab expansion technique.
|
static int |
drawTabbedText(Segment s,
int x,
int y,
Graphics g,
TabExpander e,
int startOffset) |
Deprecated.
|
static int |
getBreakLocation(Segment s,
FontMetrics metrics,
float x0,
float x,
TabExpander e,
int startOffset) |
Determine where to break the given text to fit
within the given span.
|
static int |
getBreakLocation(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset) |
Deprecated.
|
static int |
getNextWord(JTextComponent c,
int offs) |
Determines the start of the next word for the given location.
|
static Element |
getParagraphElement(JTextComponent c,
int offs) |
Determines the element to use for a paragraph/line.
|
static int |
getPositionAbove(JTextComponent c,
int offs,
float x) |
Determines the position in the model that is closest to the given
view location in the row above.
|
static int |
getPositionAbove(JTextComponent c,
int offs,
int x) |
Deprecated.
replaced by
getPositionAbove(JTextComponent, int, float) |
static int |
getPositionBelow(JTextComponent c,
int offs,
float x) |
Determines the position in the model that is closest to the given
view location in the row below.
|
static int |
getPositionBelow(JTextComponent c,
int offs,
int x) |
Deprecated.
replaced by
getPositionBelow(JTextComponent, int, float) |
static int |
getPreviousWord(JTextComponent c,
int offs) |
Determine the start of the prev word for the given location.
|
static int |
getRowEnd(JTextComponent c,
int offs) |
Determines the ending row model position of the row that contains
the specified model position.
|
static int |
getRowStart(JTextComponent c,
int offs) |
Determines the starting row model position of the row that contains
the specified model position.
|
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
float x0,
float x,
TabExpander e,
int startOffset,
boolean round) |
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) |
Deprecated.
|
static int |
getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset,
boolean round) |
Deprecated.
|
static float |
getTabbedTextWidth(Segment s,
FontMetrics metrics,
float x,
TabExpander e,
int startOffset) |
Determines the width of the given segment of text taking tabs
into consideration.
|
static int |
getTabbedTextWidth(Segment s,
FontMetrics metrics,
int x,
TabExpander e,
int startOffset) |
Deprecated.
|
static int |
getWordEnd(JTextComponent c,
int offs) |
Determines the end of a word for the given location.
|
static int |
getWordStart(JTextComponent c,
int offs) |
Determines the start of a word for the given model location.
|
@Deprecated(since="9") public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset)
drawTabbedText(Segment, float, float, Graphics2D, TabExpander, int)
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 >= 0public static final float drawTabbedText(Segment s, float x, float y, Graphics2D g, TabExpander e, int startOffset)
s
- the source of the textx
- the X origin >= 0
y
- the Y origin >= 0
g
- 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
@Deprecated(since="9") public static final int getTabbedTextWidth(Segment s, FontMetrics metrics, int x, TabExpander e, int startOffset)
getTabbedTextWidth(Segment, FontMetrics, float, TabExpander, int)
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 >= 0public static final float getTabbedTextWidth(Segment s, FontMetrics metrics, float x, TabExpander e, int startOffset)
s
- the source of the textmetrics
- the font metrics to use for the calculationx
- 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
@Deprecated(since="9") public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
getTabbedTextOffset(Segment, FontMetrics, float, float,
TabExpander, int, boolean)
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@Deprecated(since="9") public static final int getTabbedTextOffset(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset, boolean round)
getTabbedTextOffset(Segment, FontMetrics, float, float,
TabExpander, int, boolean)
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 >= 0round
- whether or not to roundpublic static final int getTabbedTextOffset(Segment s, FontMetrics metrics, float x0, float x, TabExpander e, int startOffset, boolean round)
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
round
- whether or not to round>= 0
@Deprecated(since="9") public static final int getBreakLocation(Segment s, FontMetrics metrics, int x0, int x, TabExpander e, int startOffset)
getBreakLocation(Segment, FontMetrics, float, float,
TabExpander, int)
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 textpublic static final int getBreakLocation(Segment s, FontMetrics metrics, float x0, float 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 textpublic static final int getRowStart(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of rangepublic static final int getRowEnd(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of range@Deprecated(since="9") public static final int getPositionAbove(JTextComponent c, int offs, int x) throws BadLocationException
getPositionAbove(JTextComponent, int, float)
c
- the editoroffs
- the offset in the document >= 0x
- the X coordinate >= 0BadLocationException
- if the offset is out of rangepublic static final int getPositionAbove(JTextComponent c, int offs, float x) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
x
- the X coordinate >= 0
>= 0
if the request can be computed, otherwise
a value of -1 will be returned.BadLocationException
- if the offset is out of range@Deprecated(since="9") public static final int getPositionBelow(JTextComponent c, int offs, int x) throws BadLocationException
getPositionBelow(JTextComponent, int, float)
c
- the editoroffs
- the offset in the document >= 0x
- the X coordinate >= 0BadLocationException
- if the offset is out of rangepublic static final int getPositionBelow(JTextComponent c, int offs, float x) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0
x
- the X coordinate >= 0
>= 0
if the request can be computed, otherwise
a value of -1 will be returned.BadLocationException
- if the offset is out of rangepublic static final int getWordStart(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of rangepublic static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of rangepublic static final int getNextWord(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of rangepublic static final int getPreviousWord(JTextComponent c, int offs) throws BadLocationException
c
- the editoroffs
- the offset in the document >= 0BadLocationException
- if the offset is out of rangepublic static final Element getParagraphElement(JTextComponent c, int offs)
c
- the editoroffs
- the starting offset in the document >= 0 Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-internal+0-adhoc.mlchung.jdk9-jdeps