This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I'm writing a GUI application that takes in two fractions and does a different mathmatical operations on them. I decided to give a shot at GridBagLayout, since I hadn't ever used it before. I pretty much followed an example in Deitel & Deitel for setting up the constraints, etc. Here is the relevant code: The problem is when the application Frame comes up, all I get is one giant JLabel saying "Rational Math". No other components show up! I have been able to duplicate Sun's tutorial example of the layout, and it worked perfectly. I then went into the example and started changing things to match my application, and it worked as expected. I've sat here and compared line by line, and I can't see anything wrong. Any ideas why this is happening? Thanks in advance Jason
That is all you add. addComponent( title , 0 , 4 , 1 , 1 ); You don't change title to the component you want to add. DOH
Chicken Farmer ()
Joined: May 08, 2001
OH MY GOD. I can't believe I totally did not see that. Well, there's a lesson for you, don't cut and paste your code, type the whole thing out! Someone please slap me really hard. That's what I get for trying to code AND rebuild a crashed server at the same time. At least the server's working correctly. Too bad I care more about Java Thanks Paul, I swear I kind of know what I am doing. Jason "Who just saw Legally Blonde last night and doesn't think it's funny that his friends compare him to it" Adam