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

clicking to the left white space of a target hyperlink activates the link

    Details

    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.5.1, windows_xp

      Description

      Sun bug template
      ----------------

      SYNOPSIS
      --------
      clicking to the left white space of a target hyperlink activates the link

      OPERATING SYSTEM(S):
      --------------------
      Windows XP

      FULL JDK VERSION(S):
      -------------------
      java version "1.6.0_04"
      Java(TM) SE Runtime Environment (build 1.6.0_04-b07)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      DESCRIPTION:
      ------------

      Testcase:

      import java.awt.*;
      import javax.swing.event.*;
      import javax.swing.text.html.*;
      import javax.swing.*;
      import java.awt.*;
      public class DisplayHtmlPage {
      public void init()
      {
      JFrame jf=new JFrame("Hello world");
      jf.setSize(400,200);
      JEditorPane jep=new JEditorPane("text/html","<html><body><center> First Link <br><a href=\"http://www.yahoo.com\">Yahoo</a><br>Second link<br><a href=\"http://www.google.com\">Google</a><br> End</body></html>");
      jep.setEditable(false);
      jep.addHyperlinkListener(new Hyperactive());
      jf.add(jep);
      jf.setVisible(true);
      }
      public static void main(String []str) throws Exception
      {

      new DisplayHtmlPage().init();
      }

      static class Hyperactive implements HyperlinkListener {

              public void hyperlinkUpdate(HyperlinkEvent e) {
              
                  if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                  
                      JEditorPane pane = (JEditorPane) e.getSource();
                      if (e instanceof HTMLFrameHyperlinkEvent) {
                      
                          HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
                          HTMLDocument doc = (HTMLDocument)pane.getDocument();
                          doc.processHTMLFrameHyperlinkEvent(evt);
                      } else {

                          try {
                          
                              pane.setPage(e.getURL());
                          } catch (Throwable t) {
                              t.printStackTrace();
                          }
                      }
                  }
              }
          }

      }


      Step1:
      Run the above testcase. "java DisplayHtmlPage"
      Step2:
      click at the white space of exactly left to the link displayed as "yahoo" or "google" (White space in the same line of the target hyperlink)

      Step3:
      It selects the target which is in the same line but actually not selected. <-- Problem

      Expected: It should not select the target as mouse is not over the target hyperlink.

      Note: Moving mouse over the left of the hyperlink (white space) doesn't change the mouse cursor to the hand cursor to indicate hyperlink then also hyperlink is getting selected once mouse is clicked at the whitespace.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                malenkov Sergey Malenkov (Inactive)
                Reporter:
                elarsen Erik Larsen (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: