1 24 25 package org.objectweb.cjdbc.console.gui; 26 27 import java.awt.event.KeyEvent ; 28 import java.awt.event.KeyListener ; 29 30 import javax.swing.JButton ; 31 32 38 public class FrameConfirmKeyListener implements KeyListener 39 { 40 41 JButton optionConfirm; 42 43 48 public FrameConfirmKeyListener(JButton optionConfirm) 49 { 50 super(); 51 this.optionConfirm = optionConfirm; 52 } 53 54 57 public void keyPressed(KeyEvent e) 58 { 59 if(e.getKeyCode() == KeyEvent.VK_ENTER) 60 optionConfirm.doClick(); 61 } 62 65 public void keyReleased(KeyEvent e) 66 { 67 if(e.getKeyCode() == KeyEvent.VK_ENTER) 68 optionConfirm.doClick(); 69 } 70 73 public void keyTyped(KeyEvent e) 74 { 75 if(e.getKeyCode() == KeyEvent.VK_ENTER) 76 optionConfirm.doClick(); 77 } 78 79 } 80 | Popular Tags |