• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Program is not compiles

 
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.
 
Maybe he went home and went to bed. And took this tiny ad with him:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic