Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个文本字段和 text_field2 text_fiel1。程序运行时直接将文本光标自动移至text_field1。我想问当程序在text_field2而不是text_cursor1中自动运行时,如何使文本光标?
JTextfield 的 requestFocus() 方法就可以了。看看这个http://www.java2s.com/Code/JavaAPI/javax.swing/JTextFieldrequestFocus.htm