public Map<String, String> getOptionMap() { Map<String, String> ret = new HashMap<String, String>(); for (OptionField opt : optionFields) { ret.put(opt.getName(), opt.getValue()); } return ret; }
private void addField(OptionField field) { // Add label JLabel l = new JLabel(field.getDisplayName() + ":"); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = currentRow; c.insets = new Insets(5, 2, 2, 2); c.anchor = GridBagConstraints.NORTHWEST; content.add(l, c); // Add enable checkbox if (field.getEnableToggle() != null) { c = new GridBagConstraints(); c.gridx = 1; c.gridy = currentRow; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.NORTHWEST; content.add(field.getEnableToggle(), c); } // Add field c = new GridBagConstraints(); c.gridx = 2; c.gridy = currentRow; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.NORTHWEST; content.add(field.getComponent(), c); // Add change listener field.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { fireChangeEvent(); } }); // Update state currentRow++; pack(); }