954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Multiple ActionListeners

How would I implement two listeners?
I need to implement ActionListener and MouseListener :


I have the

public class Othello extends Applet implements ActionListener


which is just below my libraries. But I also want to be able to use the MouseListener. So, I'm having trouble implementing both listeners.

I tried:

public class Othello extends Applet implements ActionListener MouseListener
1.
      public class Othello extends Applet implements ActionListener implements MouseListener


The reason I need the MouseListener is because I may want it such that one a user is over a certain part of the array, a hint shows. Or maybe, I want it so that (since my game is Othello, aka Reversi), such that when the user's mouse is over a possible move, the image changes. Regardless, I need the MouseListener and the ActionListener (that's a must).

Thank you.

IOwnAndPwnU
Newbie Poster
13 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Try this:

public class Othello extends Applet implements ActionListener , MouseListener

Hope it helps.

moutanna
Posting Whiz
387 posts since Oct 2009
Reputation Points: 16
Solved Threads: 58
 

put comma Between the listener please.
ActionListener , /*comma*/ MouseListener

moutanna
Posting Whiz
387 posts since Oct 2009
Reputation Points: 16
Solved Threads: 58
 

Thank you so much. It was an easy fix and I feel like an idiot, but troublesome nonetheless.
:)

IOwnAndPwnU
Newbie Poster
13 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

Hapy to help.

moutanna
Posting Whiz
387 posts since Oct 2009
Reputation Points: 16
Solved Threads: 58
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You