Solved

Creating hyperlinks in an applet...

Posted on 2001-06-03
8
455 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
[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
8 Comments
 

Expert Comment

by:kamalindia
ID: 6151266
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
ID: 6151845
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
ID: 6152050
i will tell u in some days that it si spossible or not !
I n doing rnd on that !

Thanx

Rohit

0
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!

 

Accepted Solution

by:
kapitany earned 50 total points
ID: 6152135
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
 
LVL 12

Expert Comment

by:ahosang
ID: 6154250
Labels do not generate events.
0
 

Expert Comment

by:kapitany
ID: 6155364
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
ID: 6173175
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
ID: 8289442
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
login jsp example 24 85
Which non-HTML GUI front end to use with Java? 3 52
Eclipse for Java EE development 2 43
Html split(text) 2 27
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

762 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