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.

Recommended Answers

All 4 Replies

Try this:

public class Othello extends Applet implements ActionListener , MouseListener

Hope it helps.

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

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

Hapy to help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.