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

Regression: JEditorPane with HTML content not sensing links

XMLWordPrintable

    • beta3
    • x86
    • windows_nt



      Name: gm110360 Date: 09/17/2001


      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      In the 1.4 beta2, a JEditorPane with HTML content is not recognizing hyperlinks
      that are inside HTML tables. There are three associated files in this report:

      JedDemo.java - the java source that illustrates the problem
      tester.html - a simple HTML file that demonstrates the basic problem
      tester2.html - a more complex HTML file that shows that a link can be completely
      unclickable
      (make sure all files are in the same directory)

      // ***JedDemo.java
      import javax.swing.*;
      import java.io.*;

      public class JedDemo
      {
          public static void main(String[] args)
          {
      JFrame appFrame = new JFrame("JEditorPane Bug");
           JEditorPane j = new JEditorPane();
      appFrame.getContentPane().add(j);
      j.setContentType("text/html");
      j.setEditable(false);
      File testFile = new File("tester.html");

      try {
      j.setPage(testFile.toURL());
      }
      catch (Exception ex) {}

              appFrame.pack();
      appFrame.setSize(700,200);
      appFrame.setVisible(true);
          }
      }
      // ***end JedDemo.java

      // ***tester.html

      <html>
      <body>
      <table COLS=2 WIDTH="100%" >
      <tr ALIGN=CENTER>
      <td ALIGN=CENTER><b><font face="Tahoma"><font size=+2><a
      href="http://finance.yahoo.com">You can click me</a></font></font></b></td>
      <td ALIGN=CENTER><b><font face="Tahoma"><font size=+2><a
      href="http://www.ebay.com">Try to click all the way over
      here!</a></font></font></b></td>
      </tr>
      </table>
      </body>
      </html>

      // ***end tester.html

      //tester2.html
      <html>
      <table border=0 cellpadding=0 cellspacing=0 width=100%>
      <tr><td>
      <table border=0 cellpadding=2 cellspacing=0 width=100%>
      <tr><td align=right>
      <a href="http://finance.yahoo.com">Try To Click Me</a>
      </td></tr>
      </table>
      </td></tr>
      </table>
      </html>

      // ***end tester2.html

      Original internal review IDs of 131505 and 131608; this is a follow-up to a
      request for more information.

      Using tester.html, notice that the word "here" on the second hyperlink is not
      clickable (the cursor does not change to the hand cursor). After changing the
      source code to point to tester2.html and recompiling, notice that the
      displayed link will not activate the hand cursor at all.

      This was working in 1.4b1.
      (Review ID: 131989)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: