求助请问这个程序要怎么修改才能使得那三个可选项显现出来并且使四个课程的选项显示在下面(仅次于Button)(这个程序本身有个错 帮忙纠正下)谢谢!!
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import javax.swing.event.*;
public class Exe9_1 {
public static void main(String args[]){
new WindowBox();
}
}
class WindowBox extends JFrame {
private JRadioButton basic;
private JRadioButton advanced;
private JCheckBox english;
private JCheckBox math;
private JTextArea text1;
private JComboBox teachers;
Box baseBox,boxV1,boxV2,p1,p2;
JButton load;
JPanel b;
private JTextField selectedTeachersText;
WindowBox(){
super("学生注册");
JButton load=new JButton("登录");
b=new JPanel();
b.add(load);
teachers = new JComboBox(new String[]{"Mike", "Jim", "Jane"});
teachers.setEditable(true);
teachers.setPreferredSize(new Dimension(20, 15));
boxV1=Box.createVerticalBox();
boxV1.add(new JLabel("学号"));
boxV1.add(Box.createVerticalStrut(80));
boxV1.add(new JLabel("姓名"));
boxV1.add(Box.createVerticalStrut(65));
boxV1.add(new JLabel("密码"));
boxV1.add(Box.createVerticalStrut(70));
boxV1.add(new JLabel("再输入一次密码"));
boxV1.add(Box.createVerticalStrut(50));
boxV1.add(new JLabel("专业"));
boxV1.add(Box.createVerticalStrut(50));
boxV1.add(new JLabel("年级"));
boxV2=Box.createVerticalBox();
boxV2.add(new JTextField(17));
boxV2.add(Box.createVerticalStrut(3));
boxV2.add(new JTextField(17));
boxV2.add(Box.createVerticalStrut(3));
boxV2.add(new JTextField(17));
boxV2.add(Box.createVerticalStrut(3));
boxV2.add(new JTextField());
boxV2.add(Box.createVerticalStrut(2));
boxV2.add(new JComboBox());
boxV2.add(Box.createVerticalStrut(5));
baseBox = Box.createHorizontalBox();
baseBox.add(boxV1);
baseBox.add(Box.createVerticalStrut(400));
baseBox.add(boxV2);
ButtonGroup group1 = new ButtonGroup();
basic = new JRadioButton("基础课程");
advanced = new JRadioButton("高级课程");
group1.add(basic);
group1.add(advanced);
english = new JCheckBox("英语");
math = new JCheckBox("数学");
text1 = new JTextArea(1, 20);
p1.add(basic);
p1.add(advanced);
baseBox.add(p1);
p2.add(english);
p2.add(math);
baseBox.add(p2);
boxV2.add(new JButton());
setLayout(new FlowLayout());
add(baseBox);
validate();
setBounds(200,50,300,800);
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
}