Search in sources :

Example 6 with AttributedStringCharacterIterator

use of org.apache.pivot.text.AttributedStringCharacterIterator in project pivot by apache.

the class TerraTextInputSkin method getCaretRectangle.

private Rectangle getCaretRectangle(TextHitInfo textCaret) {
    TextInput textInput = (TextInput) getComponent();
    AttributedStringCharacterIterator composedText = textInput.getComposedText();
    Bounds selectionStartBounds = getCharacterBounds(textInput.getSelectionStart());
    return GraphicsUtilities.getCaretRectangle(textCaret, composedText, selectionStartBounds.x, padding.top + 1);
}
Also used : Bounds(org.apache.pivot.wtk.Bounds) TextInput(org.apache.pivot.wtk.TextInput) AttributedStringCharacterIterator(org.apache.pivot.text.AttributedStringCharacterIterator)

Aggregations

AttributedStringCharacterIterator (org.apache.pivot.text.AttributedStringCharacterIterator)6 FontRenderContext (java.awt.font.FontRenderContext)4 TextLayout (java.awt.font.TextLayout)4 AttributedCharacterIterator (java.text.AttributedCharacterIterator)3 TextInput (org.apache.pivot.wtk.TextInput)3 Font (java.awt.Font)2 LineBreakMeasurer (java.awt.font.LineBreakMeasurer)2 CompositeIterator (org.apache.pivot.text.CompositeIterator)2 Bounds (org.apache.pivot.wtk.Bounds)2 Dimensions (org.apache.pivot.wtk.Dimensions)2 TextPane (org.apache.pivot.wtk.TextPane)2 TextNode (org.apache.pivot.wtk.text.TextNode)2 BasicStroke (java.awt.BasicStroke)1 Color (java.awt.Color)1 Graphics2D (java.awt.Graphics2D)1 Rectangle (java.awt.Rectangle)1 LineMetrics (java.awt.font.LineMetrics)1 Area (java.awt.geom.Area)1 Span (org.apache.pivot.wtk.Span)1 Element (org.apache.pivot.wtk.text.Element)1