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

hyperlink in swing

Tiju Thomas

Joined: May 25, 2008
Posts: 22
How do we give hyperlinks in swing? Like the in html (anchor tag).

Miklos Szeles
Ranch Hand

Joined: Oct 21, 2008
Posts: 142
Hi Tiju,

Can you be a little bit more specific? Where do you want to use a hyperlink? Are you talking about a component which displays an underlined blue text and can be clicked? If yes then you have to implement it yourself. This post can be useful.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46397
Miklos Szeles wrote: . . . This post can be useful.
It is useful, but it has some misprints in: "" or " " when " would be correct.
Brian Cole
Ranch Hand

Joined: Sep 20, 2005
Posts: 878
Consider a JButton with its border turned off.

bitguru blog
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2454
Use a JEditorPane. It can display HTML with Hyperlinks.
Tiju Thomas

Joined: May 25, 2008
Posts: 22
I actually wanted to open a url in the default browser when I click a JLabel
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10826

Let me see:
Original question posted on 28 Sep 2009
Today: 5 Feb 2010

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: hyperlink in swing
jQuery in Action, 3rd edition