frame.addWindowListener(new windowAdapter());
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
这里错了,改为:
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
注意隐藏类的写法,以及WindowAdapter类(不是windowAdapter,类名通常都是开头大写的)
还有Double n3=new Double(num3);改为Double n3=num3;直接赋值即可,
前面的double num1,num2,num3;改为double num1,num2,num3=0;需要先初始化
好了基本没错了,import少了几个:
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
----------------解决方案--------------------------------------------------------
额,还一个在frame.add之前必须先frame.setLayout(xxx);
----------------解决方案--------------------------------------------------------