Strange HyperlinkListener-Behavior

Discussion in 'Java' started by David Baer, Aug 29, 2003.

  1. David Baer

    David Baer Guest

    I have a JEditorPane with html-text. The JEditorPane is set un-editable and
    i have a HyperlinkListener attached to it. Here is the relevant code:

    JEditorPane ep = new JEditorPane();
    ep.setText(someHtmlString);
    ep.addHyperlinkListener(new Hyperactive()) ;
    ep.setContentType("text/html");
    ep.setEditable(false);
    ep.setCaretPosition(0);

    However, the HyperlinkListener does not react on most events. On some link
    it reacts, but on most it does not. I can not detect the difference or the
    reason for this behavior.

    I've found several other posts referring to this problem, but never has a
    solution been published. I have also published on comp.lang.java.gui (sorry
    for crossposting) but neither there a solution has been published.

    Has anyone encountered this problem? Any idea what the problem could be? How
    to solve it?

    Thank you for any hint!

    david
    David Baer, Aug 29, 2003
    #1
    1. Advertising

  2. David Baer

    David Baer Guest

    Sandip Chitale wrote:

    > Try reordering like this:
    >
    > JEditorPane ep = new JEditorPane();
    > ep.setContentType("text/html");
    > ep.setEditable(false);
    > ep.setText(someHtmlString);
    > ep.addHyperlinkListener(new Hyperactive()) ;
    > ep.setCaretPosition(0);
    >



    thank you - but it didn't help... :(

    i have still no clue.

    my links are in a html-table, and the links that work seem to be in a cell
    with ROWSPAN=2 while the links that don't work are have a rowspan>2.

    what's the influence of the link to the HyperlinkListener???

    d.
    David Baer, Aug 30, 2003
    #2
    1. Advertising

  3. David Baer

    David Baer Guest

    Re: Strange HyperlinkListener-Behavior / Problem found!

    OK, I've found the problem and hope I can explain it in an understandable
    way:
    The HyperlinkListner listens in an HTML-table only where the link would have
    been placed if the ROWSPAN-attributes equals 1 or if the VALIGN-attribute
    is TOP and if there really is an attribute. So if ROWSPAN=2 it reacts only
    in the top half of the link (that's why many people think it reacts
    extremly slowly). That's also the reason why you get more working links
    with verticaly-tall image-links.

    So the work-around did is to use VALIGN=TOP.

    Maybe someone else knows another solution....
    David Baer, Aug 30, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sstark
    Replies:
    0
    Views:
    455
    sstark
    Mar 6, 2005
  2. ryang
    Replies:
    1
    Views:
    930
    Wes Groleau
    Apr 11, 2005
  3. Apogee

    Strange Behavior with ViewState

    Apogee, Jul 3, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    320
    Apogee
    Jul 3, 2003
  4. Mantorok Redgormor
    Replies:
    70
    Views:
    1,710
    Dan Pop
    Feb 17, 2004
  5. Replies:
    3
    Views:
    340
    Andrew Thompson
    Aug 6, 2007
Loading...

Share This Page