File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Links? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Links?" Watch "Links?" New topic


Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Is there any way to make text appear as a link? For example, how do I make an email address showing in a Jtextfield, a link that the user can click on.
After this, then I need to know how to make it bring up a new memo in their e-mail when they click on it. The same with a URL link brining up Internet Explorer.
Any help is appreciated!
Kevin Yip
Ranch Hand

Joined: Oct 17, 2000
Posts: 110
Regarding the link, what I can think of is to use java.awt.event API to handle the mouse event. E.g. mousePressed(MouseEvent e) method of MouseListener interface.
John Kilbourne
Ranch Hand

Joined: Aug 22, 2001
Posts: 30
You could use the URL class and getText() from the textField to construct a URL, then use openConnection() to connectto it. Here's the Sun tutorial:
I'm not sure how you could view the page though without reinventing a browser in your program.
I agree. Here's the link:
subject: Links?
It's not a secret anymore!