joptions

JOptions is a library to manage options in a Swing application that can be changed by the user.

See:
          Description

Packages
org.kaiwitte.joptions  

 

JOptions is a library to manage options in a Swing application that can be changed by the user.

The dialog of this library takes care of persistance: It "negotiates" with the end user (in the option dialog) wether to save the current settings so that they are still the same when the application is launched again.

Example

Create an XML file with the following content:
<?xml version="1.0" encoding="ISO-8859-1"?> <optionsgroup> <options> <optionsname> Chat preferences </optionsname> <option> <name> Nick name </name> <value> Unknown User </value> <type> java.lang.String </type> </option> </options> </optionsgroup>
This is basically the code you need to show a dialog where the user can change the options:
InputStream in = Example02.class.getResourceAsStream("myoptions.xml"); OptionManager manager = OptionManagerFactory.createOptionManager(in, MyClass.class); manager.showDialog(frame);
This is all you need to access the option entered by the user:
Options options = manager.getOptions(); Object myOption = options.getOption("Nick name").getValue(); System.out.println(myoption.getName());
For a more real-world example run the executable jar file shipped with this library or have a look at example/Example02.java.

Specification of the XML file