0

I have a String on a JOptionPane dialog using the following html:

String email= "<html>"  + "<html><b>John Smith" + "\n<html><a href=mailto:john@smith.com>john@smith.com</a>";

This highlights the email address in blue with an underline as one would expect in html, but I thought it would be clickable, opening the default mail client with a new message using the email address provided, but it does nothing.

Is there a way to do this?

ricgeorge
  • 188
  • 3
  • 5
  • 12
  • Click http://stackoverflow.com/questions/8348063/clickable-links-in-joptionpane – stg Nov 22 '12 at 10:28

1 Answers1

1

Create a handler on the click and call the Desktop API to invoke the OS default mail client:

http://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html#mail()

Akber Choudhry
  • 1,755
  • 16
  • 24