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

Selection highlight doesn't match text in JEditorPane

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • 2d
    • x86
    • windows_nt



      Name: rm29839 Date: 02/11/98


      In JEditorPane with Java 1.2beta2, when you select
      a section of text, the highlight doesn't match
      the position of the text being selected. The highlight
      is always a little farther down the line than it
      should be. The example works fine with JDK 1.1.5.

      Example code:

      import com.sun.java.swing.*;
      import java.awt.event.*;
      import java.io.*;

      public class HTMLHighlightBug extends JPanel {
        public static void main(String s[]) {
          JFrame frame = new JFrame("HTML Highlight Bug");
          frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
          });
          frame.setSize(200, 300);
          
          JEditorPane pane = new JEditorPane();
          pane.setContentType("text/html");
          try {
            pane.read(new StringReader("<html><body>Select a portion of text. Notice the selection highlight doesn't match the text being selected. The highlight is always a little farther than down the line they should be.</body></html>"),
                      null);
          }
          catch (IOException e) {
            System.out.println("Exception = " + e);
          }
          frame.getContentPane().add("Center", pane);
          
          frame.setVisible(true);
        }
      }
      (Review ID: 24934)
      ======================================================================

            jkaulorcl Jeet Kaul (Inactive)
            rmandelsunw Ronan Mandel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: