aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How do you make the textfield and button the same size? FlowLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do you make the textfield and button the same size? FlowLayout" Watch "How do you make the textfield and button the same size? FlowLayout" New topic
Author

How do you make the textfield and button the same size? FlowLayout

Ixus See
Ranch Hand

Joined: Jul 17, 2011
Posts: 160
Hello Guys,

I'm using Flow Layout for my search panel for some reason.. The Jtextfield and button is of different height, I have try setting the size and etc. but it doesn't work.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5212
    
  12

Maybe that's just because JTextField and JButton are rendered with their default size. But I'll slide this over to the Swing forum for some expert advice.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

If your primary goal is that two adjacent components should be exactly the same size, then GridLayout would be a better choice.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Ixus See wrote:I have try setting the size and etc. but it doesn't work.


Did you set the preferredSize? also, what look & feel are you using?


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
 
subject: How do you make the textfield and button the same size? FlowLayout