File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Program is not compiles

 
Mike Shn
Ranch Hand
Posts: 149
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I'm begiiner of Java Programing language. I wrote some small Java program(JDK 1.3 is install and I'm using Jcreator(as text editor and compiler) ). But it gave me some errors:
// HelloWorld.java
import browser.Applet;
import awt.Graphics;
class HelloWorld extends Applet{
public void init(){
resize(600,300);
}
public void paint (Graphics g)
{
g.drawString("Hello World!", 50 , 100);
}
}
Errors:
--------------------Configuration: JDK version 1.3.0_02 <Default>------------------------------------------------
C:\Documents and Settings\Administrator\Desktop\HelloWorld.java:1: cannot resolve symbol
symbol : class Applet
location: package browser
import browser.Applet;
^
C:\Documents and Settings\Administrator\Desktop\HelloWorld.java:2: cannot resolve symbol
symbol : class Graphics
location: package awt
import awt.Graphics;
^
C:\Documents and Settings\Administrator\Desktop\HelloWorld.java:3: cannot resolve symbol
symbol : class Applet
location: class HelloWorld
class HelloWorld extends Applet{
^
C:\Documents and Settings\Administrator\Desktop\HelloWorld.java:7: cannot resolve symbol
symbol : class Graphics
location: class HelloWorld
public void paint (Graphics g)
^
C:\Documents and Settings\Administrator\Desktop\HelloWorld.java:5: cannot resolve symbol
symbol : method resize (int,int)
location: class HelloWorld
resize(600,300);
^
5 errors
Process completed.
 
Val Dra
Ranch Hand
Posts: 439
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am not familiar with browser package maybe you got this wrong it should be
import java.applet.*; or import java.applet.Applet;
and
import java.awt.*;
 
manish paliwal
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
First solution:- you should import java.awt.graphics; & java.applet.Applet; instead of awt.graphics; & applet.Applet
Second solution:- if you calling resize() method than it must be declared in your java program.
HOPE YOUR PROBLEM WILL BE SOLVED
------------------
manish paliwal(or just mann )
 
manish paliwal
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
First solution:- you should import java.awt.graphics; & java.applet.Applet; instead of awt.graphics; & applet.Applet
Second solution:- if you calling resize() method than it must be declared in your java program.
HOPE YOUR PROBLEM WILL BE SOLVED
------------------
manish paliwal(or just mann )
 
Val Dra
Ranch Hand
Posts: 439
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't think it has to be declared i think it's inheirited when he extended Applet but i don't remember the api.
 
Nigel Browne
Ranch Hand
Pie
Posts: 682
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Val, you are correct resize() is inherited from the Applet class.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic