Solved

Creating hyperlinks in an applet...

Posted on 2001-06-03
8
447 Views
Last Modified: 2010-05-18
how do i make a simple String as a hyperlink in my java applet and when clicked, pass some parameters in the url to the target page??
0
Comment
Question by:sidds77
8 Comments
 

Expert Comment

by:kamalindia
Comment Utility
Use getAppletContext().showDocument(URL) method to call the target page with parameter list


getAppletContext().showDocument("http://myserver.com/exampl1.jsp?site='javazone'");


Regards

Raj
0
 

Author Comment

by:sidds77
Comment Utility
hi raj,
thanks. Thats after a hyperlink is created and a user clicks on that then we can load the URL in that form.
But i want to know how to create that hyperlink in the applet. for example :
String link="Click Here";
Now how do i make this String 'link' as a hyperlink so that when a user takes the cursor over this text, it acts as an hyperlink.

0
 

Expert Comment

by:rohitgautam
Comment Utility
i will tell u in some days that it si spossible or not !
I n doing rnd on that !

Thanx

Rohit

0
 

Accepted Solution

by:
kapitany earned 50 total points
Comment Utility
HI,

you have to create your own hyperlink object. This can be a label for example. What is that you want that this does?
1, if the mouse is ower this label it changes the cursor and the text color.
Change cursor: In this case you have to add a MouseListener to your label and change the cursor:

  public void mouseEntered(MouseEvent e){
    this.setCursor( new Cursor( Cursor.HAND_CURSOR ));
myLabel.setColor(Color.blue);
}

  public void mouseExited(MouseEvent e){
    this.setCursor( new Cursor( Cursor.DEFAULT_CURSOR));
myLabel.setColor(Color.red);
}

Is that what you are looking for?

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 12

Expert Comment

by:ahosang
Comment Utility
Labels do not generate events.
0
 

Expert Comment

by:kapitany
Comment Utility
ahosang you are wrong. You can add a mouse listener to a label.
Methods inherited from class java.awt.Component
 action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener,
 addMouseListener, addMouseMotionListener, addPropertyChangeListener,
 addPropertyChangeListener,

etc, so check the API.
BR,
kapi
0
 

Author Comment

by:sidds77
Comment Utility
thanks kapitany,
that works. There's another slight problem.
This ticker applet has innumerable stock names and prices.
How do i create each individual quote and price as a hyperlink?
These qoutes are retrieved dynamically from the database.
Please help??
0
 

Expert Comment

by:SpideyMod
Comment Utility
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 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

12 Experts available now in Live!

Get 1:1 Help Now