Forums Register Login

How to save configuration for my application??

+Pie Number of slices to send: Send
Hello:
I have a GUI application, see code below, after I run it, I re-organize the positions for all labels, eg. I put them into different poistions, or put then into center of JPanel. then I quit my application,
nect time, when I re-run this program, I hope to see this last layout that I quit before: all labels are in center of JPanel,
I google a while, no good results.
Please advice how to do it and where to get goo example??
thanks


+Pie Number of slices to send: Send
I had once worked on a similar requirement, where the user could select which columns in a table to display, their order, their preferred widths etc. We had come up with a preference framework which helped us do it.

In your case, you can try a similar approach. Essentially you will need to persist the information regarding the labels in some form while quitting the application. The next time you launch the application, you can retrieve this information and use it while laying out the components.

Persisting Preference Objects or using a properties file or some DB are likely solutions. The choice depends on what kind of framework you are using.

A google on "java preference framework" will give you good results.
Best of luck.
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1451 times.
Similar Threads
Why I cannot Move my JLabel after I add SetToolTipText()??
How to draw straight line instead of curved line??
How to group these JLabels?
How to display Text String at the bottom of JLabel??
Can anybody help??
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 17:00:25.