Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hyperlink in a applet

 
anusha mandava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey..... i am an amatuer in applets and i wish to know how can I insert a hyperlink(e-mail id) in a applet...sounds silly but not for beginners like me.....hope yo hear soon from u all...
 
Tanveer Rameez
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
WEll,I dunno how you make a hyperlike on an applet, but I tell you how to lauch a browser on click of a button. Say on click of a button the actionPerformed method is invoked. then:
<code>
URL url;
String link="http://www.yoursite.com/yourfile.html";
try {
url= new URL (link);
String window="_blank";
/* "window" can be initialized as "_blank", "_top","_left,"_right", "_bottom" or simply the name of the necessary frame window*/
getAppletContext().showDocument(url,window); /* open url in necessary window*/
</code>
I would also like to know how a hyperlink is created on the applet, where the mouse cursor turns to a hand automatically on placing it on top it.
regards
Tanveer
 
Max
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
the cursor will turn into the hand shape with the following line
MyComponent.setCursor(new Cursor(Cursor.HAND_CURSOR));
let's say for the Button b = new Button("OK");
write:
b.setCursor(new Cursor(Cursor.HAND_CURSOR));

 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!