how to set new text in JTextField after creation?

前端 未结 2 1783
北荒
北荒 2021-01-22 10:35

I have a jTextField , and I set it\'s value to a certain sum when I create the frame.
Here is the initiation code:

totalTextField.setText(
            itemsP         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-22 11:18

    Before setting the frame visible again, one should update the fields with the new values / states.
    something like:

    jTextField.setText("put your text here");  
    jRadioButton.setSelected(!isSelected());  
    .  
    /* update all you need */
    .  
    jFrame.setVisible(true);
    

    The frame will come up with the new values / states.

提交回复
热议问题