This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Please help me with this grid bag layout!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Please help me with this grid bag layout!!" Watch "Please help me with this grid bag layout!!" New topic
Author

Please help me with this grid bag layout!!

Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
I'm trying to get this example to work. I keep getting...

Cannot find symbol variable "container"
Cannot find symbol variable "Both"
Cannot find symbol variable "Center"
Cannot find symbol class "Inserts"

I don't understand what I'm doing wrong.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if this is not an exercise in debugging, you will need to
download a copy of the api docs, and have them handy.

rather than tell you what the fixes are, I'll show you where
you can get the answers.

Cannot find symbol variable "container"
variable created in the program, check the spelling

Cannot find symbol variable "Both"
check the api docs for spelling/capitalization
i.e. go to the docs for the specific class (GridBagConstraints)
and check the member variables

Cannot find symbol variable "Center"
check the api docs for spelling/capitalization

Cannot find symbol class "Inserts"
check the api docs for spelling/capitalization
Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
ok, thanks for that. I always forget Java is so strict when it comes to case. I'm too use to VB lol. So I figured out all my problems in the above post, but have now ran into a new one. I created another class to call the layout but when I run it, nothing happens. No errors, no frame. I'm following this book I have exaclty and still can figure it out. Any ideas?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
perhaps this line
public class ShowGridBagLayout extends JApplet {

should be
public class ShowGridBagLayout extends JFrame {
Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
Ahh that was it. Can you tell me what the difference is? Becase my book's example uses JApplet, which obviously doesn't work.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
A JApplet runs via a html page in a browser

A JFrame is a stand-alone program
(don't know if this is the best description)
Shawn Rieger
Greenhorn

Joined: Sep 05, 2005
Posts: 16
Ahhh, Thank you! I got it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Please help me with this grid bag layout!!
 
Similar Threads
GridBagLayout, & addComp() What are the parameters?
GridBagLayout Question: Irregular Spacing
Some More GridBagLayout Help!
Alignment and Spacing between components
GridBagLayout... Components always centered vertically?