In this task we are asked to override the method onMouseLeftClick which I did and passed verification. Maybe this is a simple thing but it is still confusing to me. I didn't include any logic for mouse clicking when I overrode the method. Yet it still works. Anyone know why this is the case?
Quick question on overriding methods
You must be signed in to leave a comment
Pavlo Plynko Java Developer at CodeGym
10 October 2019, 08:16
When you run the game, some game-engine's method runs:
10 October 2019, 19:08
Okay I see. That makes a lot of sense. My original guess was that they just put the method inside an anonymous inner class to handle mouse events of some particular type. When I was learning to work with swing and javafx that's something I would do. But it looks more straightforward having one method for processing mouse clicks that calls several others that each do their own work.