import java.awt.*; import java.awt.event.*; import javax.swing.*; 1 2 void jButton1_keyPressed(KeyEvent e) { 3 if (e.getKeyChar() == 'D') { 4 this.setTitle("You Pressed D"); 5 } 6 } 7 }