Copy & Paste with formated text add additional newlines

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • 6
    • Affects Version/s: 6u2
    • Component/s: client-libs

      If I paste a formated text in an editable JTextPane or JEditorPane then it will insert an additional paragraph before and after the inserted line.

      To reproduce:
      - copy some of the text in TextPane (Ctrl-C).
      - paste the text (Ctrl-V).
      - observer 2 additional paragraphs above the pasted text.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;

      public class TestCopyAndPaste {
          
          public static void main( String[] args ) {
              
              JFrame frame = new JFrame();
              
              JTextPane text = new JTextPane();
              
              text.setContentType( "text/html" );
              
              text.setText( "<p> normal Text <font color='red'>red Text</font> <b>bold text</b>" );
              
              frame.add( text );
              
              frame.pack();
              
              frame.show();
              
          }
          
      }
      ---------- END SOURCE ----------

            Assignee:
            Peter Zhelezniakov
            Reporter:
            Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: