• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

link text inside Applet...

 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a command for linking a java text object to any URL address that will open a browser and go to that address? thanks.
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know there is not a *single* command to do this (although I could be wrong - try looking at JTextArea's JavaDocs) but what you want to do is easy enough with a couple of commands.
JTextArea supports (limited) html text. You could provide your link in html-form in the content of your JTextArea. You would install event listeners to listen for mouse-clicks on your Component, do the mapping to figure out where and what text was clicked on, extract that URL information from the text object, then use the showDocument(URL) method of java.applet.AppletContext to navigate to the page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic