Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1360
  • Last Modified:

Hyperlink a Java Applet???

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
imwalt
Asked:
imwalt
1 Solution
 
TimYatesCommented:
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
 
thirdCommented:
0
 
imwaltAuthor Commented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
thirdCommented:
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
 
TimYatesCommented:
>> ?  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
 
TimYatesCommented:
.jad files are created by an app called "JAD" which is a java decompiler
0
 
CleanupPingCommented:
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
 
VenabiliCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now