开发者

Java BorderLayout Equal Size/Alignment

Using BorderLayout, how would I add two components that are equal in size and alignment and will resize as such.

As an example, I will use textarea1 and textarea2

Initially the panel is 200,100: textarea1 is at 0,0 and has a size of 100, 100 & textarea2 is at 100, 0 with a size of 100,100

The pane is resized to 30开发者_StackOverflow社区0,300: textarea1 is at 0,0 and has a size of 150, 300 & textarea2 is at 150, 300

How can I do this with BorderLayout or any other layout manager if it is better suited to this type of activity.


Sounds like a job for GridLayout. GridLayout ensures that all components have an equal size.


I went with GridBagLayout. It allows the versatility of other layouts with the nice parts of a Grid.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜