• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet-check the code

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem with the import statement in an applet,
CAn you please check the code and tell me where am going wrong

import java.applet.Applet.*;
import java.awt.*;
public class testapplet extends java.applet.Applet{
String s;

public void init()
{
setBackground(Color.white);
s="Welcome to Java";
}

public void paint(java.awt.Graphics gc){
gc.draw3DRect(100,100,100,100,true);
}
}

The above code would not compile if I dont use Applet or Graphics class with complete path(java.applet.Applet.* etc).Can you please help which is the setting I am missing
 
yash Vi
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have resolved it myself the problem was using a * after the import java.applet.Applet.*; when Applet is a class and not a package I should not have used the same,Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic