[英]Use html mailto href in java
I have a String on a JOptionPane dialog using the following html: 我在JOptionPane对话框上使用以下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. 这会以蓝色突出显示电子邮件地址,并带有一个下划线,就像在html中一样,但是我认为它是可单击的,使用提供的电子邮件地址打开带有新消息的默认邮件客户端,但它没有任何作用。
Is there a way to do this? 有没有办法做到这一点?
Create a handler on the click and call the Desktop API to invoke the OS default mail client: 在单击上创建一个处理程序,然后调用Desktop API来调用操作系统默认的邮件客户端:
http://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html#mail () http://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html#mail ()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.