-
April 28th, 2004, 02:26 AM
#1
applet compilation
how do you compile an applet?
-
April 28th, 2004, 04:13 AM
#2
with a java compiler much the same as an application i would think
-
April 28th, 2004, 05:55 AM
#3
only running an applet differs from normal java program
u can use appletviewer or browser to view applets
Thanks n Regards
Harinath Reddy
Learn Hello World Program
A good scientist is a person with original ideas. A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering. - Freeman Dyson
-
April 28th, 2004, 07:08 AM
#4
no special way of compiling
There's no difference in compiling a applet and any other java program. After all both of 'em are java programs..
so go on with your > javac xyzapplet.java
For running the applet u may create a separate html file wih applet tag as follows..
<applet code="xyzapplet.class" width="500" height="500">
</applet>
else u can add the above code in your java file embraced within the comment marks like..
/*<applet code="yup.class" width="500" height="500">
</applet>*/
For running u can either use a browser or appletviewer
-
April 28th, 2004, 08:34 PM
#5
In order to have an applet complie and be created, you must:
- Have your class with the main method extend JApplet
- Have a method public void init() that initializes all your variables
If you have those two things, then you can make an applet. The init() method is required to override the abstract init() method in JApplet - it is called by Java when your program is first run from the internet or an appletviewer.
Last edited by Demonpants Software; April 29th, 2004 at 06:43 AM.
-
April 29th, 2004, 03:39 AM
#6
Re: no special way of compiling
Originally posted by hari_03
There's no difference in compiling a applet and any other java program. After all both of 'em are java programs..
so go on with your > javac xyzapplet.java
For running the applet u may create a separate html file wih applet tag as follows..
<applet code="xyzapplet.class" width="500" height="500">
</applet>
else u can add the above code in your java file embraced within the comment marks like..
/*<applet code="yup.class" width="500" height="500">
</applet>*/
For running u can either use a browser or appletviewer
noting, of course, that the applet tag has been deprecated in favour of object or embed. for example html, click the link "JAR Tutorial" in my signature
-
April 29th, 2004, 03:45 AM
#7
Originally posted by Demonpants Software
- Have your main method extend JApplet
- Have your main class extend JApplet [or Applet]
- Have a method public void init() that initializes all your variables
start() stop() and destroy() are all available too.
init() and destroy() are called when the applet first loads, and when the applet is being removed for sure (e.g. browser is being closed)
start() and stop() are called each time an applet is to be started or stopped. browsers may choose to stop an applet if the browser window is minimised, for example, and start it when the window is restored
think of init() as being similar to the "public static void main(String[] argv)" of a normal java program.. it is called by default. difference is, you dont have any arguments.. you must have the applet call getParameter() to read the parameters that were passed to it from the page:
http://java.sun.com/j2se/1.4.2/docs/...a.lang.String)
-
April 29th, 2004, 06:43 AM
#8
Originally posted by cjard
- Have your main class extend JApplet [or Applet]
Right, sorry. I meant the class with the main method in it. I'll edit that...
-
April 29th, 2004, 01:27 PM
#9
i was considering changing the word "main" too, to avoid confusion with the main method.. only thing, is what words are better to describe the loader class, than "the main class"
-
April 30th, 2004, 01:11 AM
#10
noting, of course, that the applet tag has been deprecated in favour of object or embed. for example html, click the link "JAR Tutorial" in my signature
Thanks cjard.. I was not in good touch with applets.. and i've missed to update myself.. Thanks for alarming me to update..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|