• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagKLayout problem

 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!