Solved

HyperLink in JApplet

Posted on 2003-10-30
7
307 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 65
servlet doXXX methods 3 62
netstat -ano | find "8000" and taskkill /f /pid 2984 3 83
Android development question 2 54
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
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…

828 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