注:这里是部分代码,仅用于说明确定光标。
JTextField tf
= new JTextField(20);
tf
.requestFocus();
this.setVisible(true);
这样写并不能实现,因为
this.setVisible(true);
这句在后面了。。
调整顺序即可:
JTextField tf
= new JTextField(20);
this.setVisible(true);
tf
.requestFocus();
转载请注明原文地址:https://ipadbbs.8miu.com/read-20794.html