Append value to JTextField?

后端 未结 2 643
迷失自我
迷失自我 2021-01-28 02:41

I want to append a value into a JTextField in Java. Something like:

String btn1=\"1\"; 
textField.appendText(btn1);
2条回答
  •  滥情空心
    2021-01-28 03:01

    I think you'll find setText is the answer. Just combine the current value with the new value:

    textField.setText(textField.getText() + newStringHere); 
    

提交回复
热议问题