Home » openjdk-7 » javax » swing » text » [javadoc | source]
javax.swing.text
public class: Utilities [javadoc | source]
java.lang.Object
   javax.swing.text.Utilities
A collection of methods to deal with various text related activities.
Method from javax.swing.text.Utilities Summary:
drawComposedText,   drawTabbedText,   drawTabbedText,   drawTabbedText,   getBreakLocation,   getJComponent,   getNextVisualPositionFrom,   getNextWord,   getNextWordInParagraph,   getParagraphElement,   getPositionAbove,   getPositionBelow,   getPrevWordInParagraph,   getPreviousWord,   getRowEnd,   getRowStart,   getTabbedTextOffset,   getTabbedTextOffset,   getTabbedTextOffset,   getTabbedTextOffset,   getTabbedTextWidth,   getTabbedTextWidth,   getWordEnd,   getWordStart,   isComposedTextAttributeDefined,   isComposedTextElement,   isComposedTextElement,   isLeftToRight,   paintComposedText
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.text.Utilities Detail:
 static int drawComposedText(View view,
    AttributeSet attr,
    Graphics g,
    int x,
    int y,
    int p0,
    int p1) throws BadLocationException 
    Draws the given composed text passed from an input method.
 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.
 static final int drawTabbedText(View view,
    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.
 static final int drawTabbedText(View view,
    Segment s,
    int x,
    int y,
    Graphics g,
    TabExpander e,
    int startOffset,
    int[] justificationData) 
 public static final int getBreakLocation(Segment s,
    FontMetrics metrics,
    int x0,
    int x,
    TabExpander e,
    int startOffset) 
    Determine where to break the given text to fit within the given span. This tries to find a word boundary.
 static JComponent getJComponent(View view) 
    If view's container is a JComponent it is returned, after casting.
 static int getNextVisualPositionFrom(View v,
    int pos,
    Bias b,
    Shape alloc,
    int direction,
    Bias[] biasRet) throws BadLocationException 
    Provides a way to determine the next visually represented model location that one might place a caret. Some views may not be visible, they might not be in the same order found in the model, or they just might not allow access to some of the locations in the model.

    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.

 public static final int getNextWord(JTextComponent c,
    int offs) throws BadLocationException 
    Determines the start of the next word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
 static int getNextWordInParagraph(JTextComponent c,
    Element line,
    int offs,
    boolean first) throws BadLocationException 
    Finds the next word in the given elements text. The first parameter allows searching multiple paragraphs where even the first offset is desired. Returns the offset of the next word, or BreakIterator.DONE if there are no more words in the element.
 public static final Element getParagraphElement(JTextComponent c,
    int offs) 
    Determines the element to use for a paragraph/line.
 public static final int getPositionAbove(JTextComponent c,
    int offs,
    int x) throws BadLocationException 
    Determines the position in the model that is closest to the given view location in the row above. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
 public static final int getPositionBelow(JTextComponent c,
    int offs,
    int x) throws BadLocationException 
    Determines the position in the model that is closest to the given view location in the row below. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
 static int getPrevWordInParagraph(JTextComponent c,
    Element line,
    int offs) throws BadLocationException 
    Finds the previous word in the given elements text. The first parameter allows searching multiple paragraphs where even the first offset is desired. Returns the offset of the next word, or BreakIterator.DONE if there are no more words in the element.
 public static final int getPreviousWord(JTextComponent c,
    int offs) throws BadLocationException 
    Determine the start of the prev word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
 public static final int getRowEnd(JTextComponent c,
    int offs) throws BadLocationException 
    Determines the ending row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
 public static final int getRowStart(JTextComponent c,
    int offs) throws BadLocationException 
    Determines the starting row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
 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.
 public static final int getTabbedTextOffset(Segment s,
    FontMetrics metrics,
    int x0,
    int x,
    TabExpander e,
    int startOffset,
    boolean round) 
 static final int getTabbedTextOffset(View view,
    Segment s,
    FontMetrics metrics,
    int x0,
    int x,
    TabExpander e,
    int startOffset,
    int[] justificationData) 
 static final int getTabbedTextOffset(View view,
    Segment s,
    FontMetrics metrics,
    int x0,
    int x,
    TabExpander e,
    int startOffset,
    boolean round,
    int[] justificationData) 
 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.
 static final int getTabbedTextWidth(View view,
    Segment s,
    FontMetrics metrics,
    int x,
    TabExpander e,
    int startOffset,
    int[] justificationData) 
 public static final int getWordEnd(JTextComponent c,
    int offs) throws BadLocationException 
    Determines the end of a word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
 public static final int getWordStart(JTextComponent c,
    int offs) throws BadLocationException 
    Determines the start of a word for the given model location. Uses BreakIterator.getWordInstance() to actually get the words.
 static boolean isComposedTextAttributeDefined(AttributeSet as) 
 static boolean isComposedTextElement(Element elem) 
 static boolean isComposedTextElement(Document doc,
    int offset) 
 static boolean isLeftToRight(Component c) 
 static  void paintComposedText(Graphics g,
    Rectangle alloc,
    GlyphView v) 
    Paints the composed text in a GlyphView