Hi all.
I have a question about a class which implements both mouseListener and mouseMotionListener in java.
I've recently been splitting up my mouse listeners into different modes in this game I'm making in java, and came across a funny issue when dealing with the Build Item listener.
For the game panel, I used two methods to reset the listeners to different modes as and when needed, so I was setting the mouseListener and the mouseMotionListener for the game panel. The Build Item listener implements both, and so was having two instances of itself created. This caused an issue with what was a non static "currently being built" object, as it would create two instances of the object with the two instances of the listener class.
See this video for a more graphical explanation... (http://www.screenjelly.com/watch/AkfFINJOUNY)
Hope that makes sense. In essence, I fixed the issue, but really, I only want to create one insatnce of the build mode listener class. Do I HAVE to set the mouseListsner and mouseMotionListsner for the game panel class, or is there some type of listener that implements both of the listener types?
This may be a really silly question, I'm not sure. This is my first real project, and I'm enjoying learning so much. I did have a quick google on this, but didn't turn up any results.
Thanks in advance you fantastic people here on Stack :)