Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes href in JOptionPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "href in JOptionPane" Watch "href in JOptionPane" New topic

href in JOptionPane

Ken Clark

Joined: Aug 02, 2004
Posts: 11
I've created a JOptionPane and am formatting the text using <html> tags. I'm able to add a link to a web site via the <a href="">Go Here</a>, and it shows up as a link in the JOptionPane. The problem is that nothing happens when I click on the link.
Do I need to create a MouseListener make this happen?

code snippet:

String message = "<html><center>";
message += "<p>Some text";
message += "<p><a href=\"\">Yahoo</a>";
message += "</center></html>";

JOptionPane.showMessageDialog(this, message, "Info", JOptionPane.INFORMATION_MESSAGE);
Have you tried LearnNowOnline?
subject: href in JOptionPane