刚刚学的 大家帮帮忙!!!
private static JPanel createMainPanel()//创建一个主面板{
JPanel panel=new JPanel();
JPanel part1=new JPanel();
part1.add(new JLabel("姓名:"));
JTextField text=new JTextField;
text.setColumns(10);
part1.add(text);
part1.setVisible(true);
panel.add(part1);
JPanel paet2=new JPanel();
paet2.add(new JLable("性别:"));//单选框
ButtonGroup group=ButtonGroup();
JRadioButton rb=new JRadioButton("男");
rb.setSelected(true);
JRadioButton rb1=new JRadioButton("女");
group.add(rb);
group.add(rb1);
part2.add(rb);
part2.add(rb1);
part2.setVisible(true);
panel.add(part2);
//创建一个容纳复选框的面板
JPanel part3=new JPanel;
part3.setLayout(new GridLayout(2,3));
JCheckBox mb=new JCheckBox("音乐");
mb.setSelected(true);
part3.add(mb);
part3.add(new JCheckBox("音乐"));
part3.add(new JCheckBox("看书"));
part3.add(new JCheckBox("上网"));
part3.add(new JCheckBox("交际"));
part3.add(new JCheckBox("工作"));
part3.setVisible(true);
part1.add(part3);
JPanel part4=new JPanel();
part4.add(new JButton("重置"));
part4.add(new JButton("确认"));
part4.setVisible(true);
part1.add(part4);
part1.setVisible(true);
return part1;
}