import java.awt.*;
import java.awt.event.*;
public class MultipleEventTester extends Frame implements WindowListener,MouseListener,KeyListener{
//定义域
public MultipleEventTester()
//定义构造方法
{
addWindowListener(this);
addMouseListener(this);
addKeyListener(this);
setSize(200,200);
//pack();
show();
}
//窗口处理事件
public void WindowClosing(WindowEvent we)
{ System.exit(0);}
public void WindowOpened(WindowEvent we)
{ System.out.println("窗口打开1");}
public void WindowIconified(WindowEvent we)
{System.out.println("窗口打开2");}
public void WindowDeiconified(WindowEvent we)
{System.out.println("窗口打开3"+we);}
public void WindowClosed(WindowEvent we)
{System.out.println("窗口打开4"+we);}
public void WindowActivated(WindowEvent we)
{System.out.println("窗口打开5"+we);}
public void WindowDeactivated(WindowEvent we)
{System.out.println("窗口打开6"+we);}
//鼠标事件处理方法
public void mousePressed(MouseEvent me)
{System.out.println("mouse Pressed"+me);}
public void mouseReleased(MouseEvent me)
{System.out.println("mouse Released"+me);}
//public void mouseReleased(MouseEvent me)
//{System.out.println("mouse Released"+me);}
public void mouseEntered(MouseEvent me)
{System.out.println("mouse Entered"+me);}
public void mouseExited(MouseEvent me)
{System.out.println("mouse Exit"+me);}
public void mouseClicked(MouseEvent me)
{System.out.println("mouse Click"+me);}
//键盘事件处理 方法
public void keyPressed(KeyEvent ke)
{System.out.println("Key Pressed1"+ke);}
public void keyReleased(KeyEvent ke)
{System.out.println("Key Released2"+ke);}
public void keyTyped(KeyEvent ke)
{System.out.println("Key Released3"+ke);}
//主函数
public static void main(String args[])
{ MultipleEventTester p=new MultipleEventTester();
}
}
---------------------------------------------------------------------------
MultipleEventTester.java:3: MultipleEventTester 不是抽象的,并且未覆盖 java.awt.
event.WindowListener 中的抽象方法 windowDeactivated(java.awt.event.WindowEvent)
public class MultipleEventTester extends Frame implements WindowListener,MouseL
istener,KeyListener{
^
注意:MultipleEventTester.java 使用或覆盖了已过时的 API。
注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。
1 错误
---------------------------------------------------------------------------------------------
本人初学JAVA 望大家多多指点