0

我发布这个问题是因为我目前是编程新手,而且我有一个烦恼,当我创建应用程序时,我不希望对象穿过整个窗口。

GridLayout最常使用,我想知道是否有办法让组件(例如 aJTextFieldJTextArea不跨越整个窗口)在两端留出一点空间?

4

1 回答 1

4

You can add a component to a JPanel, which uses a FlowLayout by default and all components are displayed at their preferred sizes. Then add the panel to the layout using the GridLayout. The panel will increase in size but the components on the panel will stay at their preferred size.

于 2013-08-15T04:15:50.247 回答