please help me with windowlistener
hi all ,
I am new to java , i wrote a simple applet , it did not work , i tried windowlistener , it gave an error when i tried to add the listener , whats wrong . But when i add mouse or key listener i dont get this error
my code :
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class maximizerepaint extends Applet implements WindowListener
{
public void init(){addWindowListener(this);}
public void start(){}
public void windowActivated(WindowEvent we){}
public void windowClosed(WindowEvent we){}
public void windowClosing(WindowEvent we){}
public void windowDeactivated(WindowEvent we){}
public void windowDeiconified(WindowEvent we){}
public void windowIconified(WindowEvent we){}
public void windowOpened(WindowEvent we){}
public void paint(Graphics g){update(g);}
public void update(Graphics g){g.drawRect(0,0,10,10);}
}
error:cannot find symbol addWindowListener(maximizerepaint)
Re: please help me with windowlistener
Hello and welcome to the javaprogrammingforums.com!
Your problem is that you're trying to add a WindowListener to an Applet, a class that has no addWindowListener(...) method, and so the compiler is justifiably complaining. I suggest that you not even use Applets but rather use a more modern GUI library, the Swing library. There are great tutorials on how to use Swing which you can find here: Using Swing Components.
Re: please help me with windowlistener
Thanks a lot !!! That gives me a start
--- Update ---
i searched the forum for books on java swing , found one , can you please suggest me some books or is the online source good enough for a beginner like me , i apologize if i am posting the wrong question for the forum
Re: please help me with windowlistener
I've already given you the best source that I know of in a link in my answer above.
Re: please help me with windowlistener