| Author |
How to make hyperlink to openup in browser and e-mail link in e-mail client
|
Raja Sekhara
Greenhorn
Joined: Dec 28, 2005
Posts: 6
|
|
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="+"support@somemail.com" +">"+"support@somemail.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 "support@somemail.com ". Hint: Goto START->RUN-> type in run field "msimn.exe support@somemail.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. Can any body know how to do this? Thanks in advance.
|
 |
Darrin Cartwright
Ranch Hand
Joined: Dec 27, 2002
Posts: 107
|
|
Hi Raja, Check out the javax.swing.event.HyperlinkEvent class. It will give you a URL you can use to execute a command on the command line. Darrin
|
Life is good on the Ponderosa,<br />but mind where you step.
|
 |
 |
|
|
subject: How to make hyperlink to openup in browser and e-mail link in e-mail client
|
|
|