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

setCharacterAttributes() not maintained after return in JTextPane

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      windows_nt

      Description

      We're using a standard JTextPane in our application and loading it with a
      DefaultStyledDocument. We've noticed that by default, the curser always
      seems to be ahead of the currently set attributes by one...reading the
      attributes ahead of itself instead of the attributes just set.

      The problem occurs when you've changed an attribute and then hit return. The
      previous or default attribute seems to be restored after the return
      character. I don't want to use paragraph attributes because I want
      to be able to change each characters attribute(s) in any given line of
      the document.

      To reproduce the problem, save the attached test case. Then run 'javac
      Formatter.java' and 'java Formatter'. This should bring up a window
      labeled "Mini Text Editor". Start typing in the JTextPane. Then change
      the Font size. You should now be typing in a different size font. Next
      hit the return key before you hit the end of the line and continue typing.
      You will notice you are returned to the original font size.

      This problem has been reproduced on Windows NT with JDK 1.2.2_001, Windows 98
      with JDK 1.2.2_005, and on Solaris 8 with JDK 1.2.2_05.

        Attachments

          Activity

            People

            • Assignee:
              svioletsunw Scott Violet (Inactive)
              Reporter:
              mhmccart Mary Mccarthy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: