• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets

 
shabbir zakir
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.applet.Applet;
import java.awt.*;
public class trail extends Applet
{
public void init()
{
setLayout(new FlowLayout());
Frame f = new Frame();
f.setVisible(true);
f.setSize(300,300);
Panel p = new Panel();
f.add(p);
}
/*
<applet<br /> Code = "trail.java"<br /> height = 600<br /> width = 600<br /> >
</applet>
*/
}
this code doesn't compile.It gives the error class awt.applet not found.
if i remove awt from the first line it compiles and executes well.
why does this happens.Is applet not a class of awt package.
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it doesn't compile for a reason. Applet class is not located in awt package but it's in applet package so if you import like this
import java.applet.Applet;
it will compile.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic