• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLayout and placements

 
Patrick Perrin Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, first time poster!

I just started teaching myself the basics of Java's JFrame and JSwing. It's all fun and games.

I've heard that GridBagLayout is THE layout to master if you want to make GUIs with Java, and I do, so I'm tying.

Newly, today, I tried making a GUI for myself, with some good results. However I ran into a problem.

My code is as follows:



What this gives me is this wonder:



Bet you can spot my problem?

Why the heck is my text box all the way over there?

How can I make it stick to my "Enter words:" label? You know, as in just to the right of it?

Thanks all, and please, be gentle, I just stared learning this stuff.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I suggest you try some simpler layouts before braving grid bag. You know you can add a panel here and a panel there, and give them different layouts?
 
Patrick Perrin Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Welcome to the Ranch

I suggest you try some simpler layouts before braving grid bag. You know you can add a panel here and a panel there, and give them different layouts?


Thank you!

And yes, that might be the best idea.

Thanks for the tip Campbell, I'll look into some more basic variants to get me comfortable.
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!