Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hyperlink a Java Applet???

Posted on 2001-08-08
8
Medium Priority
?
1,351 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
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 100 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

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!

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

877 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