• Post Reply Bookmark Topic Watch Topic
  • New Topic

applet related confusion  RSS feed

 
Vishal Hegde
Ranch Hand
Posts: 1078
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the book its said that applet can be used in source code too,instead of writing it again ang again in HTML pages...

and the code was like follows

import java.applet.Applet;
import java.awt.*;

/*<APPLET
Code=applet4.class
WIDTH=200
HEIGHT=200>
</APPLET>
*/
public class applet4 extends Applet
{
public void paint(Graphics g)
{
g.drawString("Hello",60,100);
}
}

how how will this code used in any HTML page?
 
Rob Spoor
Sheriff
Posts: 20968
84
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Applets.
 
Vishal Hegde
Ranch Hand
Posts: 1078
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime didnt get you
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't be used in any HTML page - it's for development and testing purposes only. If you embed the applet tag in the Java source code like his, then you can use appletviewer to run the applet by typing "appletviewer applet4.java". That's because appletviewer doesn't care about the rest of the file - it only looks for the applet tag.

If you want to deploy the applet for others to use, then you do need a proper HTML page (which would contain the same applet tag).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!