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
Add a WindowListener to the frame. Then you can handle the windowActivated event and reset the text of the text field.
See How to Write Window Listeners.