/*
* Button.java
*
* Created on 2009. oktober 21., 10:52
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package swing.button;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
/**
*
* @author laci
*/
public class Button extends JButton{
// <editor-fold defaultstate="collapsed" desc="Konstruktor">
/** Creates a new instance of Button */
public Button(String text) {
super(text);
initialize();
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="inicializ�l�s">
private void initialize() {
addKeyListener(
new KeyListener() {
public void keyPressed(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_ENTER) && (Button.this.isEnabled()))
Button.this.doClick();
}
public void keyReleased(KeyEvent e) { }
public void keyTyped(KeyEvent e) { }
});
}
// </editor-fold>
}