首页 > 题库 > 学历提升 > 自学考试 > 自考本科 > 设计题

类Statement显示一个窗口,其中含有一个标签、一个文本域和一个按钮。初始时,文本域中显示“This is a JFrame!”,如题33图所示。
注:要求你将方法go()中的代码补充完整,不需要实现事件处理。

题33图
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test33{
public static void main(String args []){
Statement be = new Statement();
be.go();
}
class Statement extends WindowAdapter implements ActionListener{
JFrame f; JButton myButton; JLabel myLabel; JTextField tfs;
String ad = " This is a JFrame!";
public void go(){
f= new JFrame("My JFrame");
f.setLayout(new GridLayout(6, 1, 10, 10));
f.setSize(650, 400);
myLabel = new JLabel("Statement");
JPanel panl = new JPanel( );
JPanel pan2 = new JPanel( );
panl.setLayou(new FlowLayout(FlowLayout.CENTER, 40, 0); .
//请在答题卡(纸)上填写此处应编写的代码

f.addWindowListener(his);
f.setVisible(true);
}
public void windowClosing(WindowEvente) {
System.exit(0);
}
}


参考答案: 查看答案 查看解析 下载APP畅快刷题

相关知识点试题

相关试卷