jtf1.getDocument().addDocumentListener(new DocumentListener(){
public void insertUpdate(DocumentEvent e){
jtf2.requestFocus();
}
public void removeUpdate(DocumentEvent e){}
public void changeUpdate(DocumentEvent e){}
});
public void insertUpdate(DocumentEvent e){
jtf2.requestFocus();
}
public void removeUpdate(DocumentEvent e){}
public void changeUpdate(DocumentEvent e){}
});
解决方案 »
- jar包数字签名不成功问题
- 如何用java 某一时间的unix Timestamp 在线等!!!
- 最近有招聘软件测试的,可是我学的是JAVA开发,谁能说说软件测试
- AbsHandle handle = new ProductInfo();AbsHandle handle = ProductInfo.getInstance();这两句有什么区别吗?
- 关于PushbackInputStream
- 类型转换问题 请指点一下
- 编写具有两个窗体的程序,该怎样编译?
- 文件的变量名拼写错误的检查。。。
- 谁懂得如何发送NIKIA的VCARD,格式是什么
- 我用java开发的俄罗斯方块有一点问题????想找个人帮忙,
- 大家看看这段简单的关于文件操作的例子!有个错误,不知道如何该!
- 推荐有关java的书
我猜测这个函数可能可以实现这个功能,不过我没有试,手头没有编译器
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;public class bb extends JFrame {
private JTextField[] t = new JTextField[4];
private GridLayout gridLayout1 = new GridLayout();
private KeyboardFocusManager m = new DefaultKeyboardFocusManager(); public bb() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
bb bb1 = new bb();
bb1.setSize(100,50);
bb1.setVisible(true);
}
private void jbInit() throws Exception { this.getContentPane().setLayout(gridLayout1);
for(int i = 0; i < 4; i++) {
t[i]=new JTextField();
t[i].addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(KeyEvent e) {
m.focusNextComponent();
}
});
getContentPane().add(t[i], null);
}
}
}