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

TextMeasurer.deleteChar method probs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
      2d
    • CPU:
      generic
    • OS:
      generic

      Description



      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();
       }

      }

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

        Attachments

          Activity

            People

            • Assignee:
              dougfelt Doug Felt
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: