Hi, I'm battling an error I don't quite understand.
I have a class in Java, let's call it DownloadTable
derived from a JDTable
.
Each of these classes implement KeyListener
.
I'd like the base class JDTable
to handle some keystrokes, so I put this.AddListener(this)
in its constructor and create a key handler
public void keyPressed(KeyEvent e) {...}
then I'd like the derived class DownloadTable
to do some special keyboard processing of its own, so I repeat the process and add keyboard handler there too.
I also added a call to super.processKeyEvent()
from the derived class' key handler to wire together the derived handler and the base handler.
The problem is that it doesn't work as expected and I'm getting a stack overflow exception whenever super.ProcessKeyEvent
is called. When run in debugger, the parent's event handler isn't even called. Am I missing something obvious? Isn't super.processKeyEvent()
going to somehow invoke superclass' keyPressed()
handler? Thanks.
attached stack:
Exception in thread "AWT-EventQueue-1" java.lang.StackOverflowError at jd.gui.swing.jdgui.views.downloadview.DownloadTable.keyPressed(DownloadTable.java:253) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at jd.gui.swing.jdgui.views.downloadview.DownloadTable.keyPressed(DownloadTable.java:253) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at jd.gui.swing.jdgui.views.downloadview.DownloadTable.keyPressed(DownloadTable.java:253) at java.awt.Component.processKeyEvent(Unknown Source)