Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Size of TextField increases wrt window size

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 974
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!