• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Size of TextField increases wrt window size

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
BWA HA HA HA HA HA HA! Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic