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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.