- });
- pane.add(colorWheel, BorderLayout.WEST);
- pane.add(field, BorderLayout.CENTER);
- this.add(pane, 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());
+ }
+ });
+
+ JPanel pane = new JPanel(new BorderLayout());
+ this.add(label(info), BorderLayout.WEST);
+ pane.add(browseButton, BorderLayout.WEST);
+ pane.add(field, BorderLayout.CENTER);
+ this.add(pane, BorderLayout.CENTER);
+ }
+
+ private void addComboboxField(final MetaInfo<E> info, boolean editable) {
+ // rawtypes for Java 1.6 (and 1.7 ?) support
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ final JComboBox field = new JComboBox(info.getAllowedValues());
+ field.setEditable(editable);
+ field.setSelectedItem(info.getString());
+
+ info.addReloadedListener(new Runnable() {
+ @Override
+ public void run() {
+ field.setSelectedItem(info.getString());
+ }
+ });
+ info.addSaveListener(new Runnable() {
+ @Override
+ public void run() {
+ info.setString(field.getSelectedItem().toString());
+ }
+ });
+
+ this.add(label(info), BorderLayout.WEST);
+ this.add(field, BorderLayout.CENTER);
+ }
+
+ private void addPasswordField(final MetaInfo<E> info) {
+ final JPasswordField field = new JPasswordField();
+ 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(new String(field.getPassword()));
+ }
+ });
+
+ this.add(label(info), BorderLayout.WEST);
+ this.add(field, BorderLayout.CENTER);
+ }
+
+ private void addIntField(final MetaInfo<E> info) {
+ final JTextField field = new JTextField();
+ field.setToolTipText(info.getDescription());
+ field.setText(info.getString());
+ field.setInputVerifier(new InputVerifier() {
+ @Override
+ public boolean verify(JComponent input) {
+ String text = field.getText().trim();
+ if (text.startsWith("-")) {
+ text = text.substring(1).trim();