@Override
 public String getActionCommand() {
   return other.getActionCommand();
 }
  public boolean ok_actionPerformed(ActionEvent e) {

    String in = neurons2ConnectInput.getText();

    if (in != null && in.trim().length() > 0) {

      Set<String> resultStr = new LinkedHashSet<String>();

      resultStr.addAll(Arrays.asList((in.split("\\s*,\\s*"))));

      if (resultStr.size() == 0) {
        JOptionPane.showMessageDialog(
            this, "No neurons to connect specified: " + neurons2ConnectInput.getText());
        return false;
      }

      LinkedHashSet<Display2DOptions.NeuronPair> result =
          new LinkedHashSet<Display2DOptions.NeuronPair>();

      for (String pairStr : resultStr) {
        String[] pair = pairStr.split("\\s*:\\s*");

        if (pair.length != 2) {
          JOptionPane.showMessageDialog(this, "Invalid format " + pairStr);
          return false;
        }

        Integer from;
        Integer to;

        try {
          from = new Integer(pair[0]);
        } catch (Throwable e1) {
          JOptionPane.showMessageDialog(this, "Not an integer " + pair[0]);
          return false;
        }

        try {
          to = new Integer(pair[1]);
        } catch (Throwable e1) {
          JOptionPane.showMessageDialog(this, "Not an integer " + pair[1]);
          return false;
        }

        Integer[] fromXYZ = EDatabase.getObjectXYZ(from);
        if (fromXYZ == null) {
          JOptionPane.showMessageDialog(this, "Neuron " + from + " not found in display2 table");
          return false;
        }

        Integer[] toXYZ = EDatabase.getObjectXYZ(to);
        if (toXYZ == null) {
          JOptionPane.showMessageDialog(this, "Neuron " + to + " not found in display2 table");
          return false;
        }

        result.add(new Display2DOptions.NeuronPair(from, to));
      }

      Elegance.display2DOptions.setNeurons2Connect(result);
    } else {
      Elegance.display2DOptions.setNeurons2Connect(null);
    }

    String actionCommand = "";
    ButtonModel continFilterButton = continFilterGroup.getSelection();
    if (continFilterButton != null) {
      actionCommand = continFilterButton.getActionCommand();

      Elegance.display2DOptions.setContinFilterType(
          Display2DOptions.ContinFilterType.valueOf(
              Display2DOptions.ContinFilterType.class, actionCommand));

      if (Elegance.display2DOptions.getContinFilterType()
          == Display2DOptions.ContinFilterType.custom_number) {
        Elegance.display2DOptions.setContinFilterCustom(extract(continNumberInput.getText()));
      } else if (Elegance.display2DOptions.getContinFilterType()
          == Display2DOptions.ContinFilterType.custom_name) {
        Elegance.display2DOptions.setContinFilterCustom(extract(continNameInput.getText()));
      } else if (Elegance.display2DOptions.getContinFilterType()
          == Display2DOptions.ContinFilterType.custom_color_code) {
        Elegance.display2DOptions.setContinFilterCustom(extract(continColorInput.getText()));
      }

    } else {
      throw new IllegalStateException("contin filter not selected."); // unreachable code
    }

    Elegance.display2DOptions.setSynapseType(
        Display2DOptions.SynapseType.get((String) synapsesCombo.getSelectedItem()));
    Elegance.display2DOptions.setDtype((String) dtypeCombo.getSelectedItem());
    Elegance.display2DOptions.setZoom(new Integer((String) zoomCombo.getSelectedItem()));

    return true;
  }