Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4295729

TextMeasurer.deleteChar method probs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs
    • 2d
    • generic
    • generic



      Name: naC79102 Date: 11/30/99

      java.awt.font.TextMeasurer's
      deleteChar(AttributedCharacterIterator newParagraph, int deletePos) method
      throws an ArrayIndexOutOfBoundsException for any value of deletePos.

      import java.awt.font.TextMeasurer;
      import java.text.AttributedString;
      import java.awt.font.FontRenderContext;
      import java.awt.geom.AffineTransform;
      import java.text.AttributedCharacterIterator;

      public class Test {
       public Test() {
        String string = "01234567890123456789";
        AttributedCharacterIterator text = (new
      AttributedString(string)).getIterator();
        FontRenderContext frc = new FontRenderContext(new
      AffineTransform(),true,true);
        TextMeasurer measurer = new TextMeasurer(text, frc);

              String newstring = "0123456789";
        AttributedCharacterIterator newtext = (new
      AttributedString(newstring)).getIterator();

              try {
                  measurer.deleteChar(newtext,2);
                  System.out.println("Successfully deleted character");
              }
              catch(Exception e) {
                  System.out.println("deleteChar threw "+e);
              }

       }

       public static void main(String[] args) {
        new Test();
       }

      }

      ======================================================================

            dougfelt Doug Felt
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: