protected Mark hitTest(double x, double y, TextNode node) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return null; // get the list of text runs List textRuns = getTextRuns(node, aci); if (textRuns != null) { // for each text run, see if its been hit for (int i = 0; i < textRuns.size(); ++i) { TextRun textRun = (TextRun)textRuns.get(i); TextSpanLayout layout = textRun.getLayout(); TextHit textHit = layout.hitTestChar((float) x, (float) y); Rectangle2D bounds = layout.getBounds2D(); if ((textHit != null) && (bounds != null) && bounds.contains(x,y)) return new BasicTextPainter.BasicMark(node, textHit); } } return null; }
List textRuns = getTextRuns(node, aci);
List textRuns = getTextRuns(node, aci);
List textRuns = getTextRuns(node, aci);
/** * Paints the specified text node using the specified Graphics2D. * * @param node the text node to paint * @param g2d the Graphics2D to use */ public void paint(TextNode node, Graphics2D g2d) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return; List textRuns = getTextRuns(node, aci); // draw the underline and overline first, then the actual text // and finally the strikethrough paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_UNDERLINE); paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_OVERLINE); paintTextRuns(textRuns, g2d); paintDecorations (textRuns, g2d, TextSpanLayout.DECORATION_STRIKETHROUGH); }
/** * Paints the specified text node using the specified Graphics2D. * * @param node the text node to paint * @param g2d the Graphics2D to use */ public void paint(TextNode node, Graphics2D g2d) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return; List textRuns = getTextRuns(node, aci); // draw the underline and overline first, then the actual text // and finally the strikethrough paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_UNDERLINE); paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_OVERLINE); paintTextRuns(textRuns, g2d); paintDecorations (textRuns, g2d, TextSpanLayout.DECORATION_STRIKETHROUGH); }
/** * Paints the specified text node using the specified Graphics2D. * * @param node the text node to paint * @param g2d the Graphics2D to use */ public void paint(TextNode node, Graphics2D g2d) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return; List textRuns = getTextRuns(node, aci); // draw the underline and overline first, then the actual text // and finally the strikethrough paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_UNDERLINE); paintDecorations(textRuns, g2d, TextSpanLayout.DECORATION_OVERLINE); paintTextRuns(textRuns, g2d); paintDecorations (textRuns, g2d, TextSpanLayout.DECORATION_STRIKETHROUGH); }
List textRuns = getTextRuns(textNode, aci);
protected Mark hitTest(double x, double y, TextNode node) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return null; // get the list of text runs List textRuns = getTextRuns(node, aci); if (textRuns != null) { // for each text run, see if its been hit for (Object textRun1 : textRuns) { TextRun textRun = (TextRun) textRun1; TextSpanLayout layout = textRun.getLayout(); TextHit textHit = layout.hitTestChar((float) x, (float) y); Rectangle2D bounds = layout.getBounds2D(); if ((textHit != null) && (bounds != null) && bounds.contains(x, y)) return new BasicMark(node, textHit); } } return null; }
List textRuns = getTextRuns(textNode, aci);
protected Mark hitTest(double x, double y, TextNode node) { AttributedCharacterIterator aci; aci = node.getAttributedCharacterIterator(); if (aci == null) return null; // get the list of text runs List textRuns = getTextRuns(node, aci); if (textRuns != null) { // for each text run, see if its been hit for (Object textRun1 : textRuns) { TextRun textRun = (TextRun) textRun1; TextSpanLayout layout = textRun.getLayout(); TextHit textHit = layout.hitTestChar((float) x, (float) y); Rectangle2D bounds = layout.getBounds2D(); if ((textHit != null) && (bounds != null) && bounds.contains(x, y)) return new BasicMark(node, textHit); } } return null; }
List textRuns = getTextRuns(textNode, aci);
List textRuns = getTextRuns(node, aci);
List textRuns = getTextRuns(node, aci);
List textRuns = getTextRuns(node, aci);
List textRuns = getTextRuns(textNode, aci); Iterator trI = textRuns.iterator(); int startGlyphIndex = -1;
List textRuns = getTextRuns(textNode, aci); Iterator trI = textRuns.iterator(); int startGlyphIndex = -1;
List textRuns = getTextRuns(textNode, aci); Iterator trI = textRuns.iterator(); int startGlyphIndex = -1;