Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Links?

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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: http://java.sun.com/docs/books/tutorial/networking/urls/index.html
I'm not sure how you could view the page though without reinventing a browser in your program.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic