• 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

GridLayoutFrame

 
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
 
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:

 
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?
 
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.
 
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.

..
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic