wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes HTML link on a JLabel or something Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "HTML link on a JLabel or something" Watch "HTML link on a JLabel or something" New topic
Author

HTML link on a JLabel or something

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Does anyone know or has anyone created a class for putting an HTML a href link on a JLabel or button or something that will launch the default web browser and go to the specified link?
I tried using HTML inside the Label text and that looked like it was going to work, but I didn't add any click handling events, so by default it won't work. I am going to continue to work on this, but thought if anyone has already done it, they might help me out. If I figure it out in the mean time, I will post back here.
Thanks.


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Ok, I found out a way to do this. I found a post from soneone here at the ranch from December of 2000. Here is the thread. I used that class that was posted. And then I created a LinkLabel class that looks like this:

It works in Windows. I haven't tried it in Linux. Hope this helps someone else.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I created something like this. it has lots of great features like highlighting the link in a color when hovered over and it works from an applet or an application. i plan on adding it to my open source java classes - if anyone ewants it let me know and i'll go ahead and post it for all to see/use.
it actually extends JPanel so that it fits in well anywhere in a gui.
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML link on a JLabel or something