• 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

cannot read error

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I try to compile the following file Iget the error message Cannot read. It does not seem to be a path problem as other files in the same directory are compiling,
import java.awt.*;
public class FS1 extends Frame{
FS1(){
super("Feedback");
setSize(500,500);
//Build and add Panel3.
Panel p3 = new Panel();
Label L1 = new Label("Project Continued on Revision #");
TextField T1 = new Textfield);
T1.setBackground(Color.grey);
T1.setEditable(true);
p3.add(L1);
p3.add(T1);
add(p3, BorderLayout.SOUTH);
}
}
public static void main(string args[]){
FS1 fs = new FS1();
fs.setvisible(true);
}}
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you named the file FS1.java and not something like fs1.java or Fs1.java.
ps there are numerous compile errors in this file.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also be sure that you saved it as a .txt file and not accidently as a .doc format.
 
Sartaj Syed
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use JEdit that saves all files as .java.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
It's nice when the code is formatted.

Problem: TextField is TextField, not Textfield. And you're missing the opening parenthesis.
Another Problem: Your main() is outside of the class programming block! And you have one too many closing brackets. Move main() into class programming block. Remove extra closing bracket.
Another Problem: String is String, not string. See the parameters of your main().
Another Problem: gray is gray, not grey.
Another Problem: setVisible(boolean) is setVisible(boolean), not setvisible(boolean).
Make these corrections, and it will compile.
Good Luck!
[ January 15, 2002: Message edited by: Dirk Schreckmann ]
 
Check your pockets for water buffalo. You might need to use this tiny ad until locate a water buffalo:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic