更多"下列程序中,实例tat是监听器,fr是事件源,fr上发生的事件委托ta"的相关试题:
[填空题]下列程序中,实例tat是监听器,fr是事件源,fr上发生的事件委托tat进行处理。程序的执行结果是显示一个粉红色的窗口,单击关闭按钮,可关闭窗口。请填完整程序。
import java.awt.*;
importjava.awt.event.*;
public class Testppp
{
public static void main(String args[ ])
{
Frame fr=new Frame("The Adapter!”);
TheAdapterTest tat=new TheAdapterTest( );
fr 【 】
fr.setSize(200,200);
fr.setBackground(Color.pink);
fr.setVisible(true);
}
}
class TheAdapterTest extends WindowAdapter
=
public void windowClosing(WindowEvent e)
{
System.exit(1);
}
=
[填空题]下列程序中,实例tat 是监听器,fr是事件源,fr上发生的事件委托tat进行处理。程序的执行结果是显示一个粉红色的窗口,单击关闭按钮,可关闭窗口。请将程序补充完整。
import java. awt.*;
import java. awt.event.*
public class Testppppublic static void main ( String args [])Frame fr = new Frame ("The Adapter !" );
TheAdapterTest tat=new TheAdpterTest ( ):
fr. 【14】
fr. setSize (200, 200):
fr. setBackground (Color. pink);
fr. setVisble (true):
class TheAdapterTest extends WindowAdapterpublic voidWindowClosing (WindowEvent e)System.exit ( 1);
[简答题]请完成下列Java程序。实例listener是监听器,frm是事件源,fr上发生的事件委托tat进行处理。程序的执行结果是显示一个蓝色的窗口,单击关闭按钮,可关闭窗口。
注意:请勿改动main( )主方法和其他已有的语句内容,仅在下划线处填入适当的语句。
源程序文件代码清单如下:
import java.awt.*;
import java.awt.event.*;
public class BlueWindow
public static void main(String args[])
Frame frm=new Frame ("欢迎参加Java考试!");
TheAdapterTest listener=new TheAdapterTest( );
frm. ______;
frm.setSize(200,200);
frm.setBackground(Color.blue);
frm. ______;
class TheAdapterTest extends WindowAdapter
public void windowClosing(WindowEvent e)
System.exit(1);
[单项选择]下列程序实现了2个监听器接口:ActionListener和W1ndowListener。 import java.awt.*; import java.awt.event.*; public class ex39______ { public static void main(String[] args) { ex39 obj = new ex39( ); obj .go( ); } public void go( ) { Frame f = new Frame("ex39"); f.addWindowListener(this); Button b = new Button("Button"); b.addActionListener(this); f.add(b); f.pack( ); f.setVisible(true); } public void actionPerformed(ActionEvent e) { System.out.println("Button pressed!"); } public void windowActivated(WindowEvent e){} public void windowDeactivated(WindowEvent e){} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e){System.exit(1); public void windowIconified(WindowEvent e){} public void windowDeiconified(WindowEvent e) {} public void windowOpened(WindowEvent e){} } 请选择正确的语句填入横线处。
A. extends ActionListener, WindowListener
B. implements ActionListener, WindowListener
C. implements ActionListener; WindowListener
D. extends ActionListener; WindowListener
[填空题]JDBC驱动程序实例将应用程序中基于______的Java方法转换为数据库实例能够理解的命令。