Exemplo n.º 1
0
  /** @see Graphics2D#drawString(AttributedCharacterIterator, float, float) */
  public void drawString(AttributedCharacterIterator iter, float x, float y) {
    /*
            StringBuffer sb = new StringBuffer();
            for(char c = iter.first(); c != AttributedCharacterIterator.DONE; c = iter.next()) {
                sb.append(c);
            }
            drawString(sb.toString(),x,y);
    */
    StringBuffer stringbuffer = new StringBuffer(iter.getEndIndex());
    for (char c = iter.first(); c != '\uFFFF'; c = iter.next()) {
      if (iter.getIndex() == iter.getRunStart()) {
        if (stringbuffer.length() > 0) {
          drawString(stringbuffer.toString(), x, y);
          FontMetrics fontmetrics = getFontMetrics();
          x = (float) (x + fontmetrics.getStringBounds(stringbuffer.toString(), this).getWidth());
          stringbuffer.delete(0, stringbuffer.length());
        }
        doAttributes(iter);
      }
      stringbuffer.append(c);
    }

    drawString(stringbuffer.toString(), x, y);
    underline = false;
  }
Exemplo n.º 2
0
 /** @see Graphics#drawString(AttributedCharacterIterator, int, int) */
 public void drawString(AttributedCharacterIterator iterator, int x, int y) {
   drawString(iterator, (float) x, (float) y);
 }
Exemplo n.º 3
0
 /** @see Graphics#drawString(String, int, int) */
 public void drawString(String s, int x, int y) {
   drawString(s, (float) x, (float) y);
 }