填空题

下列JApplet实现了一个不可编辑的JTextArea和一个JButton。请填写正确的程序代码。 import javax.swing.*; import java.awt.*; public class Testl7 extends JApplet { JTextArea jta; public void init() { Container cp=getContentPane(); cp.setLayout(new GridLayeut(2,1)); jta=new JTextArea(30,30); jta.setEditable(true); 【15】 jta.setText(“你好”); JButton jb=new JButton ("Ok"); cp.add(jb); } }

【参考答案】

cp.add(jta)