在练习Swing书上的代码 代码如下package Swing2;import java.awt.*;
import javax.swing.*;
import java.awt.event.*;public class EventDemo1 implements ActionListener,WindowListener {public EventDemo1()
{
JFrame f=new JFrame("EventDemo1");
Container contentPane=f.getContentPane();
JButton b=new JButton("L can speak!");
b.addActionListener(this);
contentPane.add(b);
f.pack();
f.show();                                                          //这里有一处警告!!!
f.addWindowListener(this);
}public void actionPerformed(ActionEvent e)
{
Toolkit.getDefaultToolkit().beep();
}
public void windowIconified(WindowEvent e){}
public void windowActivated(WindowEvent e){}
public void windowClosed(WindowEvent e){}
public void windowOpened(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowClosing(WindowEvent e){
System.exit(0);
}public static void main(String arg[])
{
new EventDemo1();
}}代码的功能是 按钮可以发出哔的声音 但是没有
有一个警告 The method show() from the type Window is deprecated不大清楚是什么意思
去手册上 在JFrame类里没有找到show()方法,为什么?
应该怎样修改呢?