Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Program is not compiles  RSS feed

 
Ranch Hand
Posts: 149
  • 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.
 
Ranch Hand
Posts: 439
  • 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.*;
 
Greenhorn
Posts: 16
  • 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
  • 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
  • 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.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Val, you are correct resize() is inherited from the Applet class.
 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!