Home arrow static arrow Java Programming [Archive] - Applet ActionListener Help needed
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Applet ActionListener Help needed
This topic has 2 replies on 1 page.

Posts:115
Registered: 8/22/02
Applet ActionListener Help needed  
Aug 4, 2004 2:10 PM



 
This code below

	//ADD ACTION LISTENER TO BUTTON	class NewGame implements java.awt.event.ActionListener { 	    //where initialization occurs:                         newGame.addActionListener(this);	    public void actionPerformed(ActionEvent e) {	   ............                        }	                        } 


Gives this error:
MyApplet.java:115: cannot resolve symbol
symbol : class addActionListener
location: package newGame
newGame.addActionListener(this);
^
newGame is my instance variable button which I have declared in my Applet.. I dont know whis error

Other error:
MyApplet.java:115: cannot resolve symbol
symbol : class addActionListener
location: package newGame
newGame.addActionListener(this);
^

Can someone point out whats wrong? I have imported java.swt.* and java.awt.event.*
 

Posts:1,652
Registered: 8/4/03
Re: Applet ActionListener Help needed  
Aug 4, 2004 2:28 PM (reply 1 of 2)



 
Class NewGame extends java.lang.Object. java.lang.Object doesn't have an addActionListener() method. That's what the error you're getting is telling you.

This code below

//ADD ACTION LISTENER TO BUTTONclass NewGame implements java.awt.event.ActionListener{ //where initialization occurs:newGame.addActionListener(this);public void actionPerformed(ActionEvent e) {............} } 


Gives this error:
MyApplet.java:115: cannot resolve symbol
symbol : class addActionListener
location: package newGame
newGame.addActionListener(this);
^
newGame is my instance variable button which I have
declared in my Applet.. I dont know whis error

Other error:
MyApplet.java:115: cannot resolve symbol
symbol : class addActionListener
location: package newGame
newGame.addActionListener(this);
^

Can someone point out whats wrong? I have imported
java.swt.* and java.awt.event.*
 

Posts:115
Registered: 8/22/02
Re: Applet ActionListener Help needed  
Aug 4, 2004 3:32 PM (reply 2 of 2)



 
so what should be done in this case?
 
This topic has 2 replies on 1 page.