我在使用 GridBagLayout 时遇到问题,我似乎无法掌握它。 下面是我的 GUI 应该是什么样子,我似乎无法让它工作。 主要问题是在左右手边排列文本框和标签。
最佳答案
可能是嵌套布局。对于左上角和右手边的“控件组”,将它们全部交换为 JTable
。 1 或使用 GroupLayout
2.
1) JTable
2) 组布局
另见
- > How to Use Tables
- > A Visual Guide to Swing Components
- > How to Use GroupLayout
- > A Visual Guide to Layout Managers .
- > Nested Layout Example (下图)。
关于Java 网格布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9419307/