阅读下列程序,请写出该程序的功能。
import java.applet.*; import javax.swing.*; import java.awt.event.*;
public class Class l extends Applet implements ActionListener {
JTextField text1,text2;
public void init( ) {
text1=new JTextField(10); text2=new JTextField(10);
setSize(200,100); add(text1); add(text2);
text1.addActionListener(this);
}
public void actionPerformed(Action Event e) {
long n;
if(e.getSource( )==text1) {
n=Long.parseLong(text1.getText( ));
text2.setText(String.valueOf(n*n));
}
}
}
订单号:
遇到问题请联系在线客服
订单号:
遇到问题请联系在线客服