aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes saving properties... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "saving properties..." Watch "saving properties..." New topic
Author

saving properties...

Jhedzkie Skies
Ranch Hand

Joined: Oct 28, 2009
Posts: 118
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

Joined: Oct 27, 2005
Posts: 19543
    
  16

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jhedzkie Skies
Ranch Hand

Joined: Oct 28, 2009
Posts: 118
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: saving properties...
 
Similar Threads
suncertify.properties conflict on single machine in network mode
Question about SCJD
Access ANT properties in Java program
how to run java -jar with args?
Properties files - directory structure