Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Error Message

  • 10-11-2004 01:25PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 950 ✭✭✭jessy


    post some more of your code.


  • Registered Users, Registered Users 2 Posts: 1,430 ✭✭✭Merrion


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


  • Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    lad12 wrote:
    do you mean this

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


  • Advertisement
  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 27,507 ✭✭✭✭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