This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes GridBagLayout Compile problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GridBagLayout Compile problems" Watch "GridBagLayout Compile problems" New topic
Author

GridBagLayout Compile problems

capp luckett
Ranch Hand

Joined: Dec 07, 2000
Posts: 33
HI:
I am having trouble getting my app to compile due to the
GridBagLayout.
The error I am getting is "Form.java:118: cannot resolve symbol
symbol : method add (javax.swing.JCheckBox,int,int,int,int)
location: class java.awt.Container
getContentPane().add(ckHourly, 0, 1, 1, bFill);"
In fact, I am getting a error everywhere I am doing a getContentPane().add.
Any clues would be appreciated.
The code, rather lengthy, is:


[This message has been edited by Cindy Glass (edited October 29, 2001).]


flodin
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Compare your add method with the API they don't match. You need to investigate GridBagLayout a little more. It looks like you are trying to set your grid within the add.
capp luckett
Ranch Hand

Joined: Dec 07, 2000
Posts: 33
Thanks.
I have been looking at the 1.3 API but still confused.
I am trying to add my labels, textfields and buttons in the
grid.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
Here is a link the the sun tutorial on GridBagLayout.
This link is to the explanation of using the layout.
Notice that in the explanation that the constraints are set then the component is added to the container.

In the above example a button is added to grid location 0, 0. There are other ways to position them as well but the grid location will get you started.
capp luckett
Ranch Hand

Joined: Dec 07, 2000
Posts: 33
Got it.Thanks a lot.
 
Don't get me started about those stupid light bulbs.
 
subject: GridBagLayout Compile problems