How to make hyperlink to openup in browser and e-mail link in e-mail client
Joined: Dec 28, 2005
I have one requirement to put a website address and e-mail address in a dialog, showing them like hyperlinks.
Say like adding hyperlink in JLabel. 1. new JLabel("<html><A href="+"http://www.javaranch.com" +">"+"http://www.javaranch.com"+ "</A></html>");
2. new JLabel("<html><A href="+"firstname.lastname@example.org" +">"+"email@example.com"+ "</A></html>");
In 1) when we click on hyper link it should open up website in clients default browser. I would be able to do this by adding label to a button or just hyperlink text to button and writing code in actionPerformed method.
Is there any other easy way in API.
In 2) When clicked on e-mail hyperlink, it should open up in e-mail client, showing e-mail in to field of e-mail client. For example, it should open up outlook and it should be like new message with to field filled with "firstname.lastname@example.org ".
Hint: Goto START->RUN-> type in run field "msimn.exe email@example.com" This works if you have outlook installed in your system. But it opens outlook, not the new message with TO field filled with e-mail address mentioned.
I don't know how to implement this in code for my swing application.