JTkeyAdapter.java
资源名称:Appjxc.rar [点击查看]
上传用户:whbcdz
上传日期:2008-08-04
资源大小:7683k
文件大小:1k
源码类别:
JavaScript
开发平台:
Java
- package appjxc.constrol;
- import java.awt.event.KeyAdapter;
- import javax.swing.JFormattedTextField;
- import javax.swing.JTextField;
- import javax.swing.JFrame;
- import java.awt.event.KeyEvent;
- import javax.swing.JComboBox;
- public class JTkeyAdapter extends KeyAdapter {
- private JFrame adaptee;
- private JTextField jTextField = null;
- private JComboBox jComboBox = null;
- public JTkeyAdapter(JTextField ss) {
- this.jTextField = ss;
- }
- public JTkeyAdapter(JComboBox ss) {
- this.jComboBox = ss;
- }
- public void keyPressed(KeyEvent e) {
- // System.out.println("我在匿名类中执行那");
- if (e.getKeyCode() == KeyEvent.VK_ENTER){
- if(jTextField instanceof JTextField){
- this.jTextField.requestFocus();
- }
- if (jComboBox instanceof JComboBox){
- this.jComboBox.requestFocus();
- }
- }
- }
- }