HyperLink in JApplet

Posted on 2003-10-30
Last Modified: 2012-08-13
hi ,
I want to set hyperlinks on text or lables in JApplet.Plzzzzzzzz tell me how to do that...actually i don't want to show any html page on that link...i just want to show some text in one text area when clicked on diff what shud i do??i shud use JButton or JLabel or any other component for hyperlink??

plzzzzzzzzzz help
Thanx in advance.

Question by:sushpb4u
  • 5
  • 2
LVL 35

Expert Comment

ID: 9648963
I use a JLabel with Cursor set to Cursor.HAND_CURSOR, and the font blue

then just add a mouseDown event (actionListener), and you're away :-)

Underlining the text is another thing altogether :-/
LVL 35

Expert Comment

ID: 9648973
Or here:

has a JHyperlink class
LVL 35

Expert Comment

ID: 9648988
but it basically does exactly what I said :-)

You can get the source from here:

and to underline the text, it does

public void setText( String s )
  super.setText( "<html><u>" + s + "</u></html>" ) ;

(ie: sets the text to being a bit of HTML for underline)
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Author Comment

ID: 9649101
thanx...i did that..but plz tell me how can I set underline ???
LVL 35

Accepted Solution

TimYates earned 50 total points
ID: 9649117
String s = "View This" ;
label.setText( "<html><u>" + s + "</u></html>" ) ;

Author Comment

ID: 9649122
yes got that..thanx:)
LVL 35

Expert Comment

ID: 9649304

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 97
ArrayIndexOutOfBoundException 9 81
hibernate example for saving data 19 39
Java string replace 11 46
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question