In JLabel, it is possible to use HTML. The HTML can contain hyperlinks.
Is there a way to add a listener to the JLabel so that
(a) whenever user hovers over the hyperlink, the cursor is
changed into a pointing hand, and
(b) whenever user clicks the hyperlink, the hyperlinked is
opened in a web browser?
I know how to change the cursor and how to open a hyperlink in a web
browser. I don't know what listener should listen to what events, and
how it should register itself.
Thank you, Dan
Andrew Thompson - 07 Jun 2005 03:48 GMT
> In JLabel, it is possible to use HTML. The HTML can contain hyperlinks.
> Is there a way to add a listener to the JLabel so that
Check this post for an aexample, and the thread it is in for more tips..
<http://groups-beta.google.com/group/comp.lang.java.gui/msg/c7fac340b5f27c6b?hl=en>
HTH

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Dan Polansky - 16 Jun 2005 08:10 GMT
Thanks Andrew. The example in the post you've referred me to does not
do what I am looking for. When HTML is used in JLabel, there can be
more hyperlinks in one JLabel. It is then not sufficient to listen to
mouse clicking in the JLabel and open a hyperlink whenever clicked;
only clicking at certain mouse positions should open a hyperlink.
Dan
Andrew Thompson - 16 Jun 2005 09:06 GMT
> Thanks Andrew. The example in the post you've referred me to does not
> do what I am looking for. When HTML is used in JLabel, there can be
> more hyperlinks in one JLabel. It is then not sufficient to listen to
> mouse clicking in the JLabel and open a hyperlink whenever clicked;
> only clicking at certain mouse positions should open a hyperlink.
In that case you might try implementing an HyperLinkListener
on a JEditorPane. E.G.
<http://groups-beta.google.com/group/comp.lang.java.help/msg/a2412f1190ecdd18>
HTH

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane