Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlink on GUI app

Status
Not open for further replies.
May 13, 2002
75
GB
Hi all,

just a quick question, i'm writing a GUI that the user can launch using Java Web Start (not that i think that makes any difference here) and i want a pane containing a number of labels next to a number of text fields containing data (easy so far[smarty]). What i want is the labels to actually be a hyperlink so the user can click on them to launch their web browser and view some description of what the data means. These documents are stored elsewhere on a web server somewhere so it's just a hyperlink. So how do i go about acheiving this ? My thought was could you do it with a JTextField and simply use some HTML, or if this doesn't work then use a label and add a mouse listener for a click then somehow launch their browser that way ??

thanks for any ideas / advice

Alistair
 
You can definitely make the text on a JLabel look like a hyperlink because JLabel's support HTML. I would then add a MouseListener to the JLabel and then catch the mouse click and launch the a browser using the Runtime.exec() method. There maybe an easier way to launch the browser, but this will work provided you know what browser is available.

-gc "I don't look busy because I did it right the first time."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top