Solved

HyperLink in JApplet

Posted on 2003-10-30
7
313 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Better way to make a string with template variables in java 3 53
Java List 4 76
JVM error from eclipse 1 27
Setup Eclipse for Andriod development 2 20
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

751 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