Solved

Hyperlink a Java Applet???

Posted on 2001-08-08
8
1,345 Views
Last Modified: 2013-11-23
Is it possible to make a java applet goto a link when clicked on?  I've seen some that go places, just not the one I'm using.  Maybe add a hyperlink or something?

I'm not a programmer, and basically have no clue what I'm doing, so hopefully it isn't too complicated.

I figure this should be an easy question for you guys.  If it is possible, and you can tell me how to do it in both html and FrontPage, that would be great!!  I'd probably be enticed to increase my points given.

Thanks
-WALTERisME@home.com
0
Comment
Question by:imwalt
[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
 
LVL 35

Expert Comment

by:TimYates
ID: 6367146
you have to edit the source code of the applet.  You cannot put hyperlinks on applets :-(

If you put this into the applet's java file:

  public boolean mouseUp( Event evt, int x, int y )
  {
    AppletContext context = getAppletContext() ;
    context.showDocument( "http://www.experts-exchange.com" ) ;
    return true ;
  }

and compile the applet again (this is JDK 1.0.2 compliant)

then clicking on it will bring you to experts exchange

Good Luck,

Tim
0
 
LVL 30

Expert Comment

by:third
ID: 6367160
0
 

Author Comment

by:imwalt
ID: 6369431
You said:
If you put this into the applet's java file:

 public boolean mouseUp( Event evt, int x, int y )
 {
   AppletContext context = getAppletContext() ;
   context.showDocument( "http://www.experts-exchange.com" ) ;
   return true ;
 }

Great!! But what is the applet's java file?  I have two to choose from.  Is it a .class or a .jad?  And does it matter where it goes inside the file?
0
Technology Partners: 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!

 
LVL 30

Expert Comment

by:third
ID: 6370530
jmwalt,

   when u say an applet's java file, this means the code u wrote (those save in .java file e.g. myJava.java). when u compile this java file using javac (javac.exe - java compiler), this creates a .class file (myJava.class).

e.g.
     myJava.java  // java source file
     javac myJava.java //creates a myJava.class


it only depends if u declared your source as an ordinary java application or a java applet(those seen in web browsers). to make a java applet, your program should inherit the java.applet class(built-java class).


those file in .jar (not .jad), is an archive of all classes. this is compiled using the jar (jar.exe). so a .jar file consists of several classes. e.g.
     myJar.jar has myJava.class, yourJava.class, etc...


just in case u really have this .jad file, these are source files decompiled by a java decompiler(i have seen one decompiler saves it in .jad file). so if u have this file, u need to rename it to .java file so that the java compiler can recognize ur source (rename myJava.jad to myJava.java).

more on applets, click here:

  http://java.sun.com/docs/books/tutorial/applet/TOC.html


gud luck! :)
0
 
LVL 35

Accepted Solution

by:
TimYates earned 25 total points
ID: 6371644
>> ?  I have two to choose from.  Is it a .class or a .jad?  


Hee hee..  rename the .jad file to .java

you will have something which when you open it in a text editor has something like:

public class XXXXXX extends Applet
{

  //loads of code here...

  // put it here
}

you put that method where the "put it here line" is in the above pseudo code...

then compile it with

javac blah.java

then you should be able to put that as an applet onto your webpage...

make sure you are using JDK1.1.8 or JDK1.0.2 (both downloadable from the API section of http://java.sun.com )

As browsers don't support higher JDK's (unless you have installed a plugin)

Good Luck!

Tim.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 6371648
.jad files are created by an app called "JAD" which is a java decompiler
0
 

Expert Comment

by:CleanupPing
ID: 9061902
imwalt:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 20

Expert Comment

by:Venabili
ID: 9329915
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for TimYates

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venabili
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 …
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

690 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