这是我的布局。
两个单选按钮应位于欢迎标签下方。
像这样:
__________________________
| |
| WELCOME |
| * * |
| |
| |
| |
|________________________|
两个星号是单选按钮。
我的代码:
northpanel.setLayout(new FlowLayout(FlowLayout.CENTER));
northpanel1.setLayout(new FlowLayout(FlowLayout.CENTER));
northpanel.add(welcome); //this welcome text label
northpanel1.add(r1); //this radio 1
northpanel1.add(r2); //this radio 2
add(northpanel,BorderLayout.NORTH);
add(northpanel1,BorderLayout.NORTH);
最佳答案
将northpanel
和northpanel
添加到具有panel
的GridLayout(0, 1)
中,然后
add(panel, BorderLayout.NORTH);