Link to home
Start Free TrialLog in
Avatar of gbcbr
gbcbrFlag for Cyprus

asked on

How to memorize String value into jTextField

When I open GUI, all values entered during previous session into text fields disappear.
Please advice how to remember last entered value into text field, so I don't need re-enter it again.
Thank you
Avatar of for_yan
for_yan
Flag of United States of America image

If you want to have on the start of application the same values
in textfields which user entered last time you need to persist
what user eneterd previous time in the file or i database
Avatar of gbcbr

ASKER

I heard a lot about persistence, but for me now it's black box.
Can you suggest how to start to develop it?
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbcbr

ASKER

I suppose that is what I need in my case. Just I need to understand how to connect it to my GUI.
I'll study it tomorrow.
Thank you.
I think you rather think of this stuff as the data ssociated not with GUI
but as parameters associated with your program, which you
naturalyy pick up through your GUI.
So at time when you get hold of these parameters you store them in
some object which lives wthin your program
When you ultimately leave your program you make sure you put in some good place this
object amd on start up even before you create
and populate your GUI
you just first check if there is an object stored previous time
These things are indeed more like configuration of your program
and you can store there initial values of yout textFields together
with say preferable paths for writing files.

Have a good evening.

Avatar of gbcbr

ASKER

Thank you