哪位大哥能不能帮我调试一下啊!谢谢了啊!!import java.awt.*;
import javax.swing.*;
import java.awt.event.*;public class CardLayoutTest2 extends JFrame implements ItemListener {
JComboBox cb;
JRadioButton btnRadioButton1, btnRadioButton2, btnRadioButton3,
btnRadioButton4, btnRadioButton5, btnRadioButton6, btnRadioButton7,
btnRadioButton8, btnRadioButton9;
JTextField text1, text2, text3;
JLabel label1, label2;
JPanel pane, pane1, pane2, pane3, pane4; CardLayoutTest2() {
String str[] = { "查询", "取款", "转账" };
cb = new JComboBox(str);
cb.setSize(100, 30);
cb.addItemListener(this);
pane1 = new JPanel();
pane1.setLayout(null);
pane1.add(cb); btnRadioButton4 = new JRadioButton("取款记录");
btnRadioButton4.setSelected(true);
btnRadioButton5 = new JRadioButton("转账记录");
btnRadioButton6 = new JRadioButton("当前余额");
ButtonGroup radioButtonGroup2 = new ButtonGroup();
radioButtonGroup2.add(btnRadioButton4);
radioButtonGroup2.add(btnRadioButton5);
radioButtonGroup2.add(btnRadioButton6);
pane2 = new JPanel();
pane2.add(btnRadioButton4);
pane2.add(btnRadioButton5);
pane2.add(btnRadioButton6); btnRadioButton7 = new JRadioButton("500");
btnRadioButton7.setSelected(true);
btnRadioButton8 = new JRadioButton("1000");
btnRadioButton9 = new JRadioButton("其他");
ButtonGroup radioButtonGroup3 = new ButtonGroup();
radioButtonGroup3.add(btnRadioButton7);
radioButtonGroup3.add(btnRadioButton8);
radioButtonGroup3.add(btnRadioButton9);
text1 = new JTextField(5);
pane3 = new JPanel();
pane3.add(btnRadioButton7);
pane3.add(btnRadioButton8);
pane3.add(btnRadioButton9);
pane3.add(text1); label1 = new JLabel("账号:", JLabel.LEADING);
text2 = new JTextField(5);
label2 = new JLabel("金额:", JLabel.LEADING);
text3 = new JTextField(5);
pane4 = new JPanel(new GridLayout(2, 2, -180, 5));
pane4.add(label1);
pane4.add(text2);
pane4.add(label2);
pane4.add(text3); pane = new JPanel(new CardLayout());
pane.add(pane2, "查询");
pane.add(pane3, "取款");
pane.add(pane4, "转账");
this.add(pane1, BorderLayout.NORTH);
this.add(pane, BorderLayout.CENTER);
} public void itemStateChanged(ItemEvent e) {
CardLayout cl = (CardLayout) (pane.getLayout());
cl.show(pane, (String) e.getItem());
} public static void main(String args[]) {
CardLayoutTest2 ct2 = new CardLayoutTest2();
ct2.setTitle("CardLayout");
ct2.setBounds(350, 250, 200, 200);
ct2.pack();
ct2.setResizable(false);
ct2.setVisible(true);
ct2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}