Remove the button from its container, then call revalidate().

解决方案 »

  1.   

    import java.awt.*;
    import java.applet.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class te extends Applet 
    {
    public void init(){
     // Container c=getContentPane();
    final  JRadioButton rb=new JRadioButton("一个测试");
      Button b=new Button("删除");
      b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
      remove(rb);
      validate();
      repaint();
    }
      });
      add(rb);
      add(b);
    }
    }
    /*
    <APPLET CODE="te" WIDTH="300" HEIGHT="300">
    </APPLET>
    */