|
|||||||||
PREV NEXT | FRAMES NO FRAMES |
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.
This is basically the code you need to show a dialog where the user can change the options:<?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 all you need to access the option entered by the user:InputStream in = Example02.class.getResourceAsStream("myoptions.xml"); OptionManager manager = OptionManagerFactory.createOptionManager(in, MyClass.class); manager.showDialog(frame);
For a more real-world example run the executable jar file shipped with this library or have a look at example/Example02.java.Options options = manager.getOptions(); Object myOption = options.getOption("Nick name").getValue(); System.out.println(myoption.getName());
|
|||||||||
PREV NEXT | FRAMES NO FRAMES |