Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

How to save configuration for my application??

Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??

Posts: 11497
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic