aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Size of TextField increases wrt window size Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Size of TextField increases wrt window size" Watch "Size of TextField increases wrt window size" New topic
Author

Size of TextField increases wrt window size

RaviSingh Kumar
Ranch Hand

Joined: Sep 04, 2007
Posts: 52
Added text field in a panel(Using Gridlayout) and that panel to a frame.
The size of textfield get increases as window size increase.
Wanted some combination of layout to fix this bug.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 852
Originally posted by RaviSingh Kumar:
Added text field in a panel(Using Gridlayout) and that panel to a frame.
The size of textfield get increases as window size increase.
Wanted some combination of layout to fix this bug.


Well that's how GridLayout works.

If you consider it a bug then either use an intervening panel or use a different layout completely.

By intervening panel I mean replace
add(yourTextField);
with
JPanel flowPanel = new JPanel();
flowPanel.add(yourTextField);
add(flowPanel);
// yourTextField.setColumns(width) may also be necessary, depending


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Size of TextField increases wrt window size
 
Similar Threads
Problem laying out panels in an Applet
Component size
JTextField size too big
GridBagLayout: Does not appeared properly.
Blank Frame or Panel