org.jvnet.substance.text
Class TextUtilities

java.lang.Object
  extended by org.jvnet.substance.text.TextUtilities

public class TextUtilities
extends java.lang.Object

Text utilities for painting views of text components with SubstanceTextPainter-based approach.

Author:
Kirill Grouchnikov

Constructor Summary
TextUtilities()
           
 
Method Summary
static int drawChars(javax.swing.JComponent c, java.awt.Graphics g, char[] data, int offset, int length, int x, int y)
          Draws the specified text characters.
static int drawSelectedText(java.awt.Graphics g, javax.swing.text.View view, javax.swing.text.TabExpander tabExpander, int x, int y, int p0, int p1)
           
static int drawTabbedText(javax.swing.text.View view, javax.swing.text.Segment s, int x, int y, java.awt.Graphics g, javax.swing.text.TabExpander e, int startOffset)
          Draws the specified text segment.
static int drawUnselectedText(java.awt.Graphics g, javax.swing.text.View view, javax.swing.text.TabExpander tabExpander, int x, int y, int p0, int p1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextUtilities

public TextUtilities()
Method Detail

drawTabbedText

public static int drawTabbedText(javax.swing.text.View view,
                                 javax.swing.text.Segment s,
                                 int x,
                                 int y,
                                 java.awt.Graphics g,
                                 javax.swing.text.TabExpander e,
                                 int startOffset)
Draws the specified text segment.

Parameters:
view - Text view.
s - Text segment.
x - X coordinate for the text painting.
y - Y coordinate for the text painting.
g - Graphic context.
e - Tab expander.
startOffset - The starting offset.
Returns:
X coordinate for drawing the next segment.

drawChars

public static int drawChars(javax.swing.JComponent c,
                            java.awt.Graphics g,
                            char[] data,
                            int offset,
                            int length,
                            int x,
                            int y)
Draws the specified text characters.

Parameters:
c - Component.
g - Graphic context.
data - Characters to draw.
offset - Offset into the characters array.
length - Number of characters to draw.
x - X coordinate for the text painting.
y - Y coordinate for the text painting.
Returns:
X coordinate for drawing the next segment.

drawSelectedText

public static int drawSelectedText(java.awt.Graphics g,
                                   javax.swing.text.View view,
                                   javax.swing.text.TabExpander tabExpander,
                                   int x,
                                   int y,
                                   int p0,
                                   int p1)
                            throws javax.swing.text.BadLocationException
Throws:
javax.swing.text.BadLocationException

drawUnselectedText

public static int drawUnselectedText(java.awt.Graphics g,
                                     javax.swing.text.View view,
                                     javax.swing.text.TabExpander tabExpander,
                                     int x,
                                     int y,
                                     int p0,
                                     int p1)
                              throws javax.swing.text.BadLocationException
Throws:
javax.swing.text.BadLocationException