For educational purposes, I am building a MIDI piano applet in Java. For that I want to:
- Capture key presses and releases
- Calculate the time between the same key's press and release.
What is the best way to implement key listener satisfying the above criteria?
Having only two key listeners (for key press and release) or having key listener per key?