Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Error Message

Options
  • 10-11-2004 1:25pm
    #1
    Registered Users Posts: 488 ✭✭


    FrameWithClose is not abstract and does not override abstract method windowOpened(java.awt.event.WindowEvent) in java.awt.eventWindowListener

    class FrameWithClose extends Frame implements WindowListener


    Anyone tell me how to fix the problem


Comments

  • Registered Users Posts: 950 ✭✭✭jessy


    post some more of your code.


  • Registered Users Posts: 1,421 ✭✭✭Merrion


    You must add an override for the abstract method windowOpened in your FrameWithClose class...


  • Registered Users Posts: 488 ✭✭lad12


    import java.awt.*;
    import java.awt.event.*;
    class FrameWithClose extends Frame implements WindowListener
    {
    public FrameWithClose(String title)
    {
    super(title);
    setBackground(Color.white);
    addWindowListener(this);
    }

    public void windowClosing(WindowEvent e)
    {
    System.exit(0);
    }

    public void windowClosed(WindowEvent e)
    {
    }
    }


  • Registered Users Posts: 488 ✭✭lad12


    You must add an override for the abstract method windowOpened in your FrameWithClose class...

    do you mean this

    public void windowOpened(WindowEvent e)
    {
    }


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    lad12 wrote:
    do you mean this

    public void windowOpened(WindowEvent e)
    {
    }
    That's the one.


  • Advertisement
  • Registered Users Posts: 488 ✭✭lad12


    Tried that already and its still the same


  • Closed Accounts Posts: 324 ✭✭madramor


    any reason why your not using JFrame
    you should do this
    import java.awt.Color;
    import java.awt.Frame;
    import java.awt.event.WindowListener;
    import java.awt.event.WindowEvent;
    
    public class FrameWithClose extends Frame implements WindowListener{
        
        public FrameWithClose(String title) {
            super(title);
            setBackground(Color.white);
            addWindowListener(this);
        }    
        public void windowActivated(WindowEvent e) {
        }    
        public void windowClosed(WindowEvent e) {
        }    
        public void windowClosing(WindowEvent e) {
             System.exit(0);
        }    
        public void windowDeactivated(WindowEvent e) {
        }    
        public void windowDeiconified(WindowEvent e) {
        }    
        public void windowIconified(WindowEvent e) {
        }    
        public void windowOpened(WindowEvent e) {
        }    
    }
    


  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    lad12 wrote:
    Tried that already and its still the same
    Was that a snippet or your entire class?

    you say your class implements WindowListener but you havent implemented half of these methods

    * void windowActivated(WindowEvent e)
    void windowClosed(WindowEvent e)
    void windowClosing(WindowEvent e)
    * void windowDeactivated(WindowEvent e)
    * void windowDeiconified(WindowEvent e)
    * void windowIconified(WindowEvent e)
    * void windowOpened(WindowEvent e)

    WindowListener Interface

    If you declare that your class implements an interface and your class is not abstract then it needs to at least declare each method of that interface.


Advertisement