【发布时间】:2016-07-12 01:35:00
【问题描述】:
假设我在 JPanel 中有一个 GridLayout,如果我的布局不足以填满整个 JPanel,它会自动将其对齐在 JPanel 的中心,例如:
所以我的组件将从面板的左上角开始,有什么方法可以做到吗?
【问题讨论】:
-
@AhYong 可能你的意思是 GridBagLayout?
-
你能把 FlowLayout 设置成 JPanel 会根据你的要求自动设置
-
使用 GridBagLayout。