• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Frustrated at GridBagLayout

 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is all you add.
addComponent( title , 0 , 4 , 1 , 1 );
You don't change title to the component you want to add.
DOH
 
jason adam
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic