Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridLayoutFrame

 
peter huff
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by peter huff:
gridLayoutFrame gridLayoutFrame = new GridLayoutFrame();
^


see the error carefully.
The line in the program should be:
GridLayoutFrame gridLayoutFrame = new GridLayoutFrame();
 
peter huff
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this is the code as it appears in the book and on the cd there is also the linked code:

 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
peter huff
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic