Solved

HyperLink in JApplet

Posted on 2003-10-30
7
294 Views
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 links...so what shud i do??i shud use JButton or JLabel or any other component for hyperlink??

plzzzzzzzzzz help
Thanx in advance.

0
Comment
Question by:sushpb4u
  • 5
  • 2
7 Comments
 
LVL 35

Expert Comment

by:TimYates
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 :-/
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9648973
Or here:

http://www.jgui.com/

has a JHyperlink class
0
 
LVL 35

Expert Comment

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

You can get the source from here:
http://www.jgui.com/downloads/jgui_source_17_oct_03.zip

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)
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

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

Accepted Solution

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

Author Comment

by:sushpb4u
ID: 9649122
yes got that..thanx:)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9649304
:-)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
This video teaches viewers about errors in exception handling.

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now