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打开后总是报错,Java开发网 - 一个简单java 程序为什么总是报错(must implement the inherited abstract method)... 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729232780a1191638.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论