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

JTextPane:Selection shifts to next characters set while inserting component on selection content.

    • Cause Known
    • generic
    • generic

      BugInfo:
      ========
      I have selected first 10 characters by programmatic using selection methods and then i was trying to insert a button component using insert component method in JTextPane.
      API says,Inserts a component into the document as a replacement for the currently selected content.But selection shifts to next 10 characters and the caret shows at end of the selection instead of showing after the inserted component.

      I typed some characters for replacing the selection contents but it erases selected content including component also instead of erasing only selected content.

      Steps to reproduce:
      ===================
      1. Run the attached code.

      Now you can see the component followed by some selected content.But as per my program i am expecting behavior should be following manner.

      Component followed by content with out selection and the caret should be after the component.
      If i type some characters then it appends to beginning position of existing content.


      Actual Behavior:
      ================
      Component followed by some selected content and typed some characters,it erases the selected portion including component.

      Please check the attached code snippet.

      I can reproduce the issue even with 5.0 also.

            peterz Peter Zhelezniakov
            vthotasunw Vinay Thota (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: