All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.text.Utilities
java.lang.Object
|
+----com.sun.java.swing.text.Utilities
- public class Utilities
- extends Object
A collection of methods to deal with various text
related activities.
-
Utilities()
-
-
drawTabbedText(Segment, int, int, Graphics, TabExpander, int)
- Draws the given text, expanding any tabs that are contained
using the given tab expansion technique.
-
getTabbedTextOffset(Segment, FontMetrics, int, int, TabExpander, int)
- Determines the relative offset into the given text that
best represents the given span in the view coordinate
system.
-
getTabbedTextWidth(Segment, FontMetrics, int, TabExpander, int)
- Determines the width of the given segment of text taking tabs
into consideration.
Utilities
public Utilities()
drawTabbedText
public static final int drawTabbedText(Segment s,
int x,
int y,
Graphics g,
TabExpander e,
int startOffset)
- Draws the given text, expanding any tabs that are contained
using the given tab expansion technique. This particular
implementation renders in a 1.1 style coordinate system
where ints are used and 72dpi is assumed.
- Parameters:
- s - the source of the text
- x - the X origin
- y - the Y origin
- g - the graphics context
- e - how to expand the tabs
- startOffset - starting offset in the document of the text
- Returns:
- s the location at the end of the rendered text
getTabbedTextWidth
public static final int getTabbedTextWidth(Segment s,
FontMetrics metrics,
int x,
TabExpander e,
int startOffset)
- Determines the width of the given segment of text taking tabs
into consideration. This is implemented in a 1.1 style coordinate
system where ints are used and 72dpi is assumed.
- Parameters:
- s - the source of the text
- metrics - the font metrics to use for the calculation
- x - the X origin
- e - how to expand the tabs
- startOffset - starting offset in the document of the text
- Returns:
- s the width of the text
getTabbedTextOffset
public static final int getTabbedTextOffset(Segment s,
FontMetrics metrics,
int x0,
int x,
TabExpander e,
int startOffset)
- Determines the relative offset into the given text that
best represents the given span in the view coordinate
system. This is implemented in a 1.1 style coordinate
system where ints are used and 72dpi is assumed.
- Parameters:
- 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
- startOffset - starting offset in the document of the text
- Returns:
- s the offset into the text
All Packages Class Hierarchy This Package Previous Next Index