问题 单项选择题

WindowListener中可以实现窗口关闭功能的方法是( )。

A.public void windowOpened(WindowEvente)

B.public void windowClosed(WindowEvente)

C.public void windowClosing(WindowEvente)

D.public void windowDeactivated(WindowEvent

答案

参考答案:B

解析: 本题考查事件监听器的概念。窗口事件接口WindowListener有几个关键方法,应该注意,如public void windowClosing(WindowEvent e)是把退出窗口的语句写在本方法中;pubic void windowOpened(WindowEvent e)是窗口打开时调用;public void windowClose d(indnwEvent e)是窗口关闭时调用,选项B正确;public void windowIconified(WindowEve nt e)是窗口图标化时调用;public void windowDeiconified (WindowEvent e)是窗口非图标化时调用;public void windowActivated (WindowEvent e)是窗口激活时调用:public void windowDeactivated(WmdowEvent e)是窗口非激活时调用。

单项选择题
单项选择题