Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2005

Tip: Looking for answers? Try searching our database.

To listen to clicking on hyperlink in HTML in JLabel

Thread view: 
Dan Polansky - 06 Jun 2005 18:56 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

(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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.