Package swing.button

Source Code of swing.button.Button

/*
* 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>
 
}
TOP

Related Classes of swing.button.Button

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.