问答题
注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。
import java.awt.*;
import java.awt.event.*;
public class PingFangShu{
public static void main(String args[ ] ){
______________________
}
}
class AppFrame extends Frame{
TheAdapterTest listener=new TheAdapterTest();
TextField in=new TextField(5);
Button btn=new Button("计算");
Label out=new Label ("用于显示计算结果");
public AppFrame()
{
setLayout(new FlowLayout());
add(in);
add(btn);
add(out);
btn.addActionListener(new BtnActionAdapter());
addWindowListener(listener);
setSize(400,100);
show();
}
class BtnActionAdapter implements ActionListener{
public void actionPerformed(ActionEvent e){
String s=in.getText();
double d= _________________________
double sq=d*d;
out.setText(d+"的平方是: "+sq);
}
}
class TheAdapterTest extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(l);
}
}
}