Package java.awt.font

Examples of java.awt.font.TextLayout.draw()


            tx = -advance/2;
            break;
        case TextNode.Anchor.ANCHOR_END:
            tx = -advance;
        }
        layout.draw(g2d, (float)(location.getX() + tx), (float)(location.getY()));
    }

}
View Full Code Here


        if (inPossibleRecursion) {
            System.err.println("Called itself: drawString(AttributedCharacterIterator)");
        } else {
            inPossibleRecursion = true;
            TextLayout layout = new TextLayout(iterator, getFontRenderContext());
            layout.draw(this, x, y);
            inPossibleRecursion = false;
        }
    }

    /**
 
View Full Code Here

      float ascent = textLayout.getAscent();
      textY += ascent; // Move down to baseline.

      g2d.setColor(glowColor);
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 + 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 + 1);

      g2d.setColor(getForeground());
View Full Code Here

      textY += ascent; // Move down to baseline.

      g2d.setColor(glowColor);
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 + 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 + 1);

      g2d.setColor(getForeground());
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
View Full Code Here

      g2d.setColor(glowColor);
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 + 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 + 1);

      g2d.setColor(getForeground());
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
      textLayout.draw(g2d, textX + glowSize / 2, textY + glowSize / 2);
View Full Code Here

      g2d.setColor(glowColor);
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 + 1, textY + glowSize / 2 + 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 + 1);

      g2d.setColor(getForeground());
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
      textLayout.draw(g2d, textX + glowSize / 2, textY + glowSize / 2);
View Full Code Here

      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 - 1);
      textLayout.draw(g2d, textX + glowSize / 2 - 1, textY + glowSize / 2 + 1);

      g2d.setColor(getForeground());
      g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
      textLayout.draw(g2d, textX + glowSize / 2, textY + glowSize / 2);

      textY += textLayout.getDescent() + textLayout.getLeading(); // Move down to top of next line.
    }
  }
 
View Full Code Here

        if (useDrawRotatedStringWorkaround) {
            // workaround for JDC bug ID 4312117 and others...
            final TextLayout tl = new TextLayout(text, g2.getFont(),
                    g2.getFontRenderContext());
            tl.draw(g2, textX, textY);
        }
        else {
            AttributedString as = new AttributedString(text,
                    g2.getFont().getAttributes());
          g2.drawString(as.getIterator(), textX, textY);
View Full Code Here

      Rectangle2D rectangle = textLayout.getBounds();
      int height = (int) rectangle.getHeight();
      int top = Math.abs((height - CaptchaImage.HEIGHT));

      graphics.setColor(this.getFontColor());
      textLayout.draw(graphics, left, top);
      left += 20;
    }
  }

  private int getWidth() {
View Full Code Here

            tx = -advance/2;
            break;
        case TextNode.Anchor.ANCHOR_END:
            tx = -advance;
        }
        layout.draw(g2d, (float)(location.getX() + tx), (float)(location.getY()));
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.