| Author |
GridLayoutFrame
|
peter huff
Greenhorn
Joined: Nov 14, 2005
Posts: 14
|
|
I'm currently trying to understand how GridLayoutFrames work and have got some code from a text book I am working from (from a cd, I didnt type it in so it should be correct), there are two .java files, one, GridLayoutFrame.java does compile however, the other GridLayoutDemo.java does not and I get the following message GridLayoutDemo.java:9: cannot find symbol symbol : class gridLayoutFrame location: class GridLayoutDemo gridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^ GridLayoutDemo.java:9: cannot find symbol symbol : class GridLayoutFrame location: class GridLayoutDemo gridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^ 2 errors does anyone know why this is? if needs be I can post the code. Thanks
|
 |
Sunny Kumar
Ranch Hand
Joined: Oct 27, 2005
Posts: 57
|
|
Originally posted by peter huff: gridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^
see the error carefully. The line in the program should be: GridLayoutFrame gridLayoutFrame = new GridLayoutFrame();
|
<a href="http://lifesmind.blogspot.com/" target="_blank" rel="nofollow">My Blog</a>
|
 |
peter huff
Greenhorn
Joined: Nov 14, 2005
Posts: 14
|
|
i already tried that but it gave me the following message: GridLayoutDemo.java:9: cannot find symbol symbol : class GridLayoutFrame location: class GridLayoutDemo GridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^ GridLayoutDemo.java:9: cannot find symbol symbol : class GridLayoutFrame location: class GridLayoutDemo GridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^ 2 errors
|
 |
peter huff
Greenhorn
Joined: Nov 14, 2005
Posts: 14
|
|
this is the code as it appears in the book and on the cd there is also the linked code:
|
 |
John Wetherbie
Rancher
Joined: Apr 05, 2000
Posts: 1441
|
|
The code as posted generates the following error: javac GridLayoutDemo.java GridLayoutDemo.java:7: cannot find symbol symbol : class gridLayoutFrame location: class GridLayoutDemo gridLayoutFrame gridLayoutFrame = new GridLayoutFrame(); ^ 1 error As Sunny Kumar noted you need to change the first gridLayoutFrame to GridLayoutFrame. This is because the compiler is looking for a type named gridLayoutFrame and it doesn't exist. Change this to GridLayoutFrame and the classes compile and run fine. You get a window that has six light blue buttons labeled one through six. You click one and the layout changes. One thing I notice is that you are getting two error messages but you should only be getting one. This implies that even when you fixed the code correctly something else may be preventing the compiler from seeing the GridLayoutFrame class. Maybe there is something messed up in your classpath? [ January 14, 2006: Message edited by: John Wetherbie ]
|
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
|
 |
peter huff
Greenhorn
Joined: Nov 14, 2005
Posts: 14
|
|
|
that makes sense that it may be something mucked up in the way |I've set java up. To set the class path i went into control panel-->system-->advanced-->environment variables-->path and then tagged the file directory where the bin is for the jdk. That is right isnt it?
|
 |
Larry Reynolds
Greenhorn
Joined: Oct 22, 2005
Posts: 24
|
|
Could someone post, or direct me to, the other Java file that goes with the one discussed, I am new to Java and would like to try running these files. Thanks.
|
 |
Nageswar Kakolla
Ranch Hand
Joined: Jan 16, 2006
Posts: 71
|
|
Hi Peter, I think you should import GridLayoutFrame into GridLayoutDemo file and that is the reason, Compiler is not able to find GridLayoutFrame Class when GridLayOutDemo is compiled. ..
|
 |
 |
|
|
subject: GridLayoutFrame
|
|
|