Solved

Creating hyperlinks in an applet...

Posted on 2001-06-03
8
458 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding multiple JVM environments to RedHat 6 7 83
java example issue 5 67
junit initializtion error 2 22
JVM error from eclipse 1 27
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
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…
This video teaches viewers about errors in exception handling.
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