import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
public class JComboBox8_11 extends JFrame implements ActionListener
{
	int number=1;
	JLabel lb=new JLabel("会员编号");
	JTextField td=new JTextField(10);	
	JTextArea ta=new JTextArea();
	ButtonGroup group=new ButtonGroup();
	JRadioButton radio1=new JRadioButton("已付款",true);
	JRadioButton radio2=new JRadioButton("未付款");	
	Object subject[]={"汉族","回族","满族","壮族","苗族"};
	JComboBox combox=new JComboBox(subject);
	JButton button=new JButton("信息汇总");
	JPanel panel=new JPanel();
	public JComboBox8_11()
	{
		super("组合框举例");
		this.setSize(280,220);
		this.setVisible(true);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.getContentPane().setLayout(new GridLayout(1,2));
		this.getContentPane().add(panel);
		this.getContentPane().add(ta);
		panel.setLayout(new GridLayout(6,1));
		panel.add(lb);
		panel.add(td);
		group.add(radio1);
		group.add(radio2);
		panel.add(radio1);
		panel.add(radio2);
		panel.add(combox);
		panel.add(button);	
		button.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e) 
	{		
		String str;
		str="编号："+"\n";
		str=str+td.getText()+"\n";
		if(e.getSource()==button)
		{
			if(radio1.isSelected())
				str=str+radio1.getText()+"\n";
			if(radio2.isSelected())
				str=str+radio2.getText()+"\n";
			str=str+combox.getSelectedItem();
			ta.setText(str);
		}		
	}
	public static void main(String[] args) 
	{
		JComboBox8_11 frame=new JComboBox8_11();
	}
}