posted 14 years ago
Hi,
I'm actually able to get this ode to work but I just don't understand why one way works and the other doesn't - would appreciate it if someone could explain it to me...
So I've got a class that represents a tab in a tabbed pane (MapTab), this tab contains an instance of the DrawingCanvas class for drawing shapes. First, in the MapTab class, I register the drawingCanvas object to listen to mouse events (the DrawingCanvas class implements the MouseListener & MouseMotionListener interfaces. This works fine:
Then, I was trying to register drawingCanvas as a listener for key events in the same way, but it doesnt work.... the parts I changed:
In MapTab class:
DrawingCanvas class:
What does work, however, is this:
MapTab class:
DrawingCanvas class:
I don't get why the first method, which is the same as in case of mouse events, doesnt work...
would appreciate some comments, thanks!