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
Author

href in JOptionPane

Ken Clark
Greenhorn

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);
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: href in JOptionPane