This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saving properties...

 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've got an eye on this very useful class of java...

java.util.Properties

well. i tried to read and understand the API but i guess, its really too advanced for me..
anyway, i just want to apply the saving of properties on my app,,

i have a menu in my program that will change the WindowDecorationStyle. but, i want my program to save the current decoration so when
my program is executed again, it will load the same style.
please help me understand the usage of properties in the most simple way..

thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's so advanced about Properties? You can:
- retrieve properties if you know the name by using getProperty
- set properties using setProperty
- get all property names using propertyNames, stringProperties or (using the fact that Properties extends Hashtable) keySet
- put contents of a file into the Properties object using load. You can use a FileInputStream or FileReader to read from files, or Class.getResourceAsStream to read from resources
- save the contents to a file using store. You can use FileOutputStream or FileWriter for files; you can't write to resources
 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:What's so advanced about Properties? You can:
- retrieve properties if you know the name by using getProperty
- set properties using setProperty
- get all property names using propertyNames, stringProperties or (using the fact that Properties extends Hashtable) keySet
- put contents of a file into the Properties object using load. You can use a FileInputStream or FileReader to read from files, or Class.getResourceAsStream to read from resources
- save the contents to a file using store. You can use FileOutputStream or FileWriter for files; you can't write to resources


thanks mr. rob prime.
this definitely lightened up things for me. i'll try to work on it and post here some improvements.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic