how can i get java to enter/type text into a textbox for me once i select it(click inside it) so the cursor is there. Also how would i get it to send the enter key or other "non-text" keys.
Progr4mmer
0
Junior Poster
Recommended Answers
Jump to PostYou can determine focus with a focusListener:
final JTextField field = new JTextField(20); field.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent arg0) { field.setText("Enter Your Text"); } @Override public void focusLost(FocusEvent arg0) { // Do something clever } });
and you determine if enter, f1, etc was pushed …
Jump to Posthow can i get java to enter/type text into a textbox for me once i select it(click inside it) so the cursor is there. Also how would i get it to send the enter key or other "non-text" keys.
If you want your program to automatically insert text into its …
All 5 Replies

ztini
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
mKorbel
274
Veteran Poster
Progr4mmer
0
Junior Poster
mKorbel
274
Veteran Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.