This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes GridLayout Stretch my JTextFields... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "GridLayout Stretch my JTextFields..." Watch "GridLayout Stretch my JTextFields..." New topic

GridLayout Stretch my JTextFields...

Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 80

How to avoid this behavior?

I have to put each JTextField in a different JPanel? Seems strange to me...

I want to make my screen like this:


Sou i try one GridLayout 3x2 but it stretch TextFields...

What to do?


Julio Cesar Lopes Marques
Sun Certified Java Developer 5, Sun Certified Java Programmer 5
K. Tsang

Joined: Sep 13, 2007
Posts: 2985

For GridLayouts, the components stretches to fill the space. You can put the JTextField onto a JPanel then put this JPanel to the GridLayout.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: GridLayout Stretch my JTextFields...
It's not a secret anymore!