- /**
- * Save the current value to the {@link Bundle}.
- */
- public void save() {
- value = valueField.getText();
- bundle.setString(id, value);
+ field.setSelected(state);
+
+ info.addReloadedListener(new Runnable() {
+ @Override
+ public void run() {
+ Boolean state = info.getBoolean();
+ if (state == null) {
+ info.getDefaultBoolean();
+ }
+ if (state == null) {
+ state = false;
+ }
+
+ field.setSelected(state);
+ }
+ });
+ info.addSaveListener(new Runnable() {
+ @Override
+ public void run() {
+ info.setBoolean(field.isSelected());
+ }
+ });
+
+ field.setText(info.getName());
+ this.add(field, BorderLayout.CENTER);
+ } else {
+ final JTextField field = new JTextField();
+ field.setToolTipText(info.getDescription());
+ field.setText(info.getString());
+
+ info.addReloadedListener(new Runnable() {
+ @Override
+ public void run() {
+ field.setText(info.getString());
+ }
+ });
+ info.addSaveListener(new Runnable() {
+ @Override
+ public void run() {
+ info.setString(field.getText());
+ }
+ });
+
+ this.add(label(info.getName()), BorderLayout.WEST);
+ this.add(field, BorderLayout.CENTER);
+ }