Skip to content

Instantly share code, notes, and snippets.

@jakejarvis
Created June 28, 2013 13:28
Show Gist options
  • Save jakejarvis/5884645 to your computer and use it in GitHub Desktop.
Save jakejarvis/5884645 to your computer and use it in GitHub Desktop.
private class MyKeyListener implements KeyListener {
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
System.out.println("keyPressed="+KeyEvent.getKeyText(e.getKeyCode()));
if(KeyEvent.getKeyText(e.getKeyCode()).equals("J")) {
System.out.println("hello!");
getAudioClip(getDocumentBase(), "bach_847.mid").loop();
}
}
public void keyReleased(KeyEvent e) {
System.out.println("keyReleased="+KeyEvent.getKeyText(e.getKeyCode()));
if(KeyEvent.getKeyText(e.getKeyCode()).equals("J")) {
System.out.println("hello!");
getAudioClip(getDocumentBase(), "bach_847.mid").stop();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment