Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes cannot read error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "cannot read error" Watch "cannot read error" New topic
Author

cannot read error

Sartaj Syed
Greenhorn

Joined: Nov 11, 2001
Posts: 22
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);
}}
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
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.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Also be sure that you saved it as a .txt file and not accidently as a .doc format.
Sartaj Syed
Greenhorn

Joined: Nov 11, 2001
Posts: 22
I use JEdit that saves all files as .java.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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 ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: cannot read error
 
Similar Threads
Action Listener
buttons don't work
take a look at this please
validating awt textfields
validating awt textfields