问题 填空题

程序的功能是在第一个文本框中输入整数,输入结束回车后,在第二个文本框中输出该整数和平方。
import java. applet.*;
import javax. swing.*;
import java. awt. event.*;
public class Class04 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. ______;

public void actionPerformed(Action Evnet e)

long n;
if(e. get Source()==text1)

n=Long. parseLong(text1. getText());
text2.______(String. valueOf(n*n));


答案

参考答案:addActionListener(this)
setText

问答题 简答题
判断题