2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by aj.wh.ca
0

how can i create a weblink in my java program. I tried adding a weblink in JLabel usign the html tags:

JLabel wwwLink = new JLabel("<html><a href=\"http://www.domain.com\">my link</a></html>");
panel.add(wwwLink);

But the text came out blue as if it were a link, but nothing happens when you click on it.

I just want a JLabel to tell the os to visit a website and then let the os take it from there

Hi,
I dont think JLabel has the capability of clickable URLs.
I think following links should help you.
www.rgagnon.com/javadetails/java-0273.html
www.devdaily.com/java/applets/URLButton/URLButton.java

cheers,
aj.wh.ca

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.