Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applets

 
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.
 
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.
 
I would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic