admin管理员组

文章数量:1636810

Posted by:cln240

Posted on:2007-04-07 10:15

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.awt.event.WindowListener.*;

class MyWindowListener implements WindowListener

{

public void windowClosing(WindowEvent w)

{

System.out.print("Window Closing");

System.exit(0);

}

public void windowClosed(WindowEvent w)

{

}

public void windowOpened(WindowEvent w)

{

}

public void windowIconified(WindowEvent w)

{

}

public void windowDeiconified(WindowEvent w)

{

}

public void windowActivated(WindowEvent w)

{

}

}

class MyFrameWindow extends JFrame

{

JButton b1;

public static void main(String args[])

{

MyFrameWindow f1 = new MyFrameWindow();

}

public MyFrameWindow()

{

super("Window Title");

b1 = new JButton("Click here");

getContentPane().add(b1);

ButtonListener blisten = new ButtonListener();

b1.addActionListener(blisten);

setSize(200,200);

setVisible(true);

MyWindowListener wListen = new MyWindowListener();

addWindowListener(wListen);

}

class ButtonListener implements ActionListener

{

public void actionPerformed(ActionEvent evt)

{

JButton source = (JButton)evt.getSource();

source.setText("Button clicked");

}

}

}

报错:

The type MyWindowListener must implement the inherited abstract method WindowListener.windowDeactivated(WindowEvent)

本文标签: 报错简单程序Java