Hi this what you want is not so easy. Two days ago we had the same discussion. There I told the guy, that he should better take the null layout. Then it is possible to resize components. In case of GridBagLayout, all the available space is provided by the LayoutManager. Only the manager can set the size. So the thing you have to do, is to change the size of the Frame. Maybe this is not that, what you want, but in my opinion, there is no better solution. Here is a class, which implements the behavior I described.
I am not sure exactly what you mean by resize but you could set the fill to GridBagConstraints.HORIZONTAL and the gridwidth to GridBagConstraints.REMAINDER when you add the text area and it should take up the rest of the row. Take a look at this example . If you replace a text field with a text area, I think it does what you are asking. ps In my opinion, null layout is never a valid option. my .02
That's exactly what my example does. My TextArea takes all the available space. But I think, this is not what Richard wants. I think he wants to create an event, which changes the size of the TextArea (and maybe he wants to specify the size with a Dimension), if I understand him right. In my opinion, this is not possible with GridBagLayout. The only way I see is null layout, but there are two facts: I agree, null layout is a very bad solution. I don't know, what is the advantage of the resizable TextArea? If it is inside of a ScrollPane, you are able to see all, you need. Regards Rene
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop