import java.awt.*;
import java.awt.event.*;public class WindowEventTest extends Frame implements WindowListener
{
public static void main(String args[])
{
WindowEventTest test=new WindowEventTest();
test.setSize(300,200);
test.addWindowListener(test);
test.show();
}
}编译的时候提示错误
WindowEventTest is not abstract and does not override abstract method windowOpened(java.awt.event.WindowEvent)in java.awt.event.WindowListener请教为什么会出现这种错误,怎么解决
import java.awt.event.*;public class WindowEventTest extends Frame implements WindowListener
{
public static void main(String args[])
{
WindowEventTest test=new WindowEventTest();
test.setSize(300,200);
test.addWindowListener(test);
test.show();
}
}编译的时候提示错误
WindowEventTest is not abstract and does not override abstract method windowOpened(java.awt.event.WindowEvent)in java.awt.event.WindowListener请教为什么会出现这种错误,怎么解决
public void windowClosed(WindowEvent e);
public void windowClosing(WindowEvent e);
public void windowDeactivated(WindowEvent e);
public void windowDeiconified(WindowEvent e);
public void windowIconified(WindowEvent e);
public void windowOpened(WindowEvent e);你要在你的类中一一实现。建议继承WindowAdapter,它实现了WindowListener。