Java Textfield focus

后端 未结 2 715
野的像风
野的像风 2021-01-15 12:12

Hello I have a problem with the focus

mytext= new JTextField();
mytext.requestFocus(true);
gc.fill =GridBagConstraints.HORIZONTAL ;
gc.gridx =3; gc.gridy=4;
         


        
2条回答
  •  有刺的猬
    2021-01-15 12:47

    As for selecting all the text you should use...

    mytext.selectAll();
    

    As for getting focus, maybe you should try the requestFocus function after everything has been added to jContentPane.

提交回复
热议问题