Addes debug statements to screen.
@@ -547,9 +547,13 @@ public class Screen {
}
for (final EventListener listener : temp.getEventListeners()) {
+ if (listener == null) {
+ System.out.println("Found null event listener on component: " + temp);
+ } else {
removeListener(listener);
}
}
+ }
// Reset all of the tiles where the component used to be.
final int startX = component.getTiles().getXPosition();
@@ -600,16 +604,19 @@ public class Screen {
if (listener instanceof KeyListener) {
canvas.addKeyListener((KeyListener) listener);
+ System.out.println("Added KeyListener (Screen): " + listener.hashCode());
continue;
}
if (listener instanceof MouseListener) {
canvas.addMouseListener((MouseListener) listener);
+ System.out.println("Added MouseListener (Screen): " + listener.hashCode());
continue;
}
if (listener instanceof MouseMotionListener) {
canvas.addMouseMotionListener((MouseMotionListener) listener);
+ System.out.println("Added MouseMotionListener (Screen): " + listener.hashCode());
continue;
}
@@ -634,16 +641,19 @@ public class Screen {
if (listener instanceof KeyListener) {
canvas.removeKeyListener((KeyListener) listener);
+ System.out.println("Removed KeyListener (Screen): " + listener.hashCode());
continue;
}
if (listener instanceof MouseListener) {
canvas.removeMouseListener((MouseListener) listener);
+ System.out.println("Removed MouseListener (Screen): " + listener.hashCode());
continue;
}
if (listener instanceof MouseMotionListener) {
canvas.removeMouseMotionListener((MouseMotionListener) listener);
+ System.out.println("Removed MouseMotionListener (Screen): " + listener.hashCode());
continue;
}
