• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet-check the code

 
yash Vi
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic