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

Copy & Paste with formated text add additional newlines

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 6
    • 6u2
    • 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 ----------

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: