import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class exa9_15  extends JFrame implements ActionListener{
  JFrame frm=new JFrame("Single selection."); 
  JRadioButton rb1,rb2;      	//ѡť
  JPanel p1;
  ButtonGroup bgroup;      	//ѡť
  JLabel label;     
public exa9_15(){
  setForeground(Color.white);
  setSize(200,100);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frm.getContentPane().setLayout(new BorderLayout());     //߽粼ֹ
  bgroup=new ButtonGroup();
  label=new JLabel("Ʋܼãѡ");
  getContentPane().add(label,"North"); 
  p1=new JPanel();
  rb1=new JRadioButton("",true);       
  rb1.addActionListener(this);     	//Ϊѡťעᶯ
  bgroup.add(rb1);              	//ѡдѡť
  p1.add(rb1);                 	//ѵѡťӵһ
  rb2=new JRadioButton("צ",false);
  rb2.addActionListener(this);
  bgroup.add(rb2);
  p1.add(rb2);              
  getContentPane().add(p1,"South");      //ӵ
}
public void actionPerformed(ActionEvent e){//ѡеѡťĴ
  if(e.getSource()==rb1) { label.setText("ѡ");   }
  if(e.getSource()==rb2) {  label.setText("ѡ"); }
}
public static void main(String[]args) {
  JFrame frame=new exa9_15();
  frame.show(); }
}
