wood burning stoves
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 Java Interview Guide this week in the Jobs Discussion 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="www.somwhere.com">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=\"http://www.yahoo.com\">Yahoo</a>";
message += "</center></html>";

JOptionPane.showMessageDialog(this, message, "Info", JOptionPane.INFORMATION_MESSAGE);
I agree. Here's the link: http://aspose.com/file-tools
subject: href in JOptionPane
It's not a secret anymore!