• 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

GridBagKLayout problem

 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have a simple panel with text fileds & a button arage in to a row.
The button must have a fix size and must be allway on the right side.
The text field must be resible and must fill the space between the left border & the right component(the button).
I try to use the GridBagLayout but it seamns that the cells have the same size(width & height) and I can not place the button on the right exteme.
I try for the text field the const.
cst.gridwidth = GridBagConstraints.RELATIVE; (next to end)
and for the button
cst.fill = GridBagConstraints.NONE;
cst.anchor = GridBagConstraints.NORTHWEST ;
cst.gridwidth = GridBagConstraints.REMAINDER; (the end) but there is still a lot of space between the button and the right limit.
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use the cst.weightx(y) = 1.0(0) the stuff seans to work
For more info see also the :
http://javaalmanac.com/egs/java.awt/gridbag_Stretch.html?l=rel
 
reply
    Bookmark Topic Watch Topic
  • New Topic