How can I focus the text field in the code?

I want to focus the libGDX text field from Codeside without clicking on the text field.
Is there any way to do this?

+6
source share
2 answers

I had the same question, finally found the answer by looking at the text field code.

You can focus your text field by doing the following:

stage.setKeyboardFocus(textField); //show the keyboard textField.getOnscreenKeyboard.show(true); 

Hope this helps someone.

+15
source

replace the component name with jtextfield in the following code:

 jtextfield.requestFocus(); 
-6
source

Source: https://habr.com/ru/post/948923/


All Articles