应该怎么实现接口阿?不能关闭窗口我知道了,因为没有加入退出窗口的语句吧
system.exit

解决方案 »

  1.   

    那两个notes是因为你用一个现在的新版本jdk不赞成使用的老版本的jdk的api,在编译时加一个-deprecation的参数应该就可以了。至于不能close,应该不是这方面的原因,我没做过,不清楚
      

  2.   

    写类的时候,像show();就不要写进去了,
    在实现时写就好了。我认为是这样,很多例程也这样。
      

  3.   

    import java.awt.*;
    import java.awt.event.*;
    public class Window1 implements WindowListener
    {
      public Window1() {
        Frame f = new Frame("First Window!");
        f.setSize(300,200);
        f.setVisible(true);
        f.addWindowListener(this);
      }
      public void windowClosing(WindowEvent e){
        System.exit(1);
      }
      public void windowOpened(WindowEvent e){
      }
      public void windowIconified(WindowEvent e){
      }
      public void windowDeiconified(WindowEvent e){
      }
      public void windowClosed(WindowEvent e){
      }
      public void windowActivated(WindowEvent e){
      }
      public void windowDeactivated(WindowEvent e){
      }
      public static  void main(String args[])
      {
        Window1 win1 = new Window1();
      }
    }
      

  4.   

    在main()中加入:
    win1.addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e)
            {
            System.exit(0);
            }
           });