sendfocuseadapter.java
来自「一个简单的学生成绩管理系统.具有完备的学生信息管理模块,基本信息的全面设置」· Java 代码 · 共 43 行
JAVA
43 行
/*
* SendFocuseAdapter.java
*
* Created on 2008年5月15日, 上午10:05
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package appstu.util;
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 SendFocuseAdapter extends KeyAdapter {
private JFrame adaptee;
private JTextField jTextField = null;
private JComboBox jComboBox = null;
public SendFocuseAdapter(JTextField ss) {
this.jTextField = ss;
}
public SendFocuseAdapter(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();
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?