/** EdiDialog constructor comment. */
  public void show() {
    getContentPane().setLayout(new java.awt.BorderLayout());
    JScrollPane center = new JScrollPane();
    getContentPane().add(center, java.awt.BorderLayout.CENTER);
    list = new JList();
    list.setBackground(parentWindow.getBackground());
    DefaultListModel model = new DefaultListModel();
    list.setModel(model);
    for (int i = 0; i < DesignFrame.processingElements.length; i++) {
      model.addElement((String) DesignFrame.processingElements[i][0]);
    }

    // list.ActionListener((ActionListener) this);
    center.setViewportView(list);

    JPanel down = new JPanel();
    getContentPane().add(down, java.awt.BorderLayout.SOUTH);
    down.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 2, 2));
    bOK = new JButton("OK");
    bOK.addActionListener(this);
    bAdd = new JButton("Add");
    bAdd.addActionListener(this);
    bCancel = new JButton("Cancel");
    bCancel.addActionListener(this);
    down.add(bOK);
    down.add(bAdd);
    down.add(bCancel);
    pack();
    setSize(getWidth(), getHeight() * 2);

    list.addKeyListener(this);
    super.show();
  }
  /** Invoked when an action occurs. */
  public void actionAdd() {
    int i = list.getSelectedIndex();

    if (i == -1) return;

    newItem =
        createNewElement(
            (String) DesignFrame.processingElements[list.getSelectedIndex()][1], cX, cY);
  }
  /** EdiDialog constructor comment. */
  public String getSelectedElementName(Object src) {
    String name = null;
    if (src == list) {
      name = (String) list.getSelectedValue();
    } else if (src == bOK) {
      name = (String) list.getSelectedValue();
      if (name == null) {
        // Button ok was pressed, but no selection was done, do nothing
        return null;
      }
    } else {
      dispose();
      return null;
    }

    return name;
  }
  /** EdiDialog constructor comment. */
  public void keyReleased(java.awt.event.KeyEvent e) {
    if (e.getSource() == list) {
      switch (e.getKeyCode()) {
        case KeyEvent.VK_DELETE:
        case KeyEvent.VK_BACK_SPACE:
          if (keys.length() > 0) keys.setLength(keys.length() - 1);
          break;
        case KeyEvent.VK_ESCAPE:
          dispose();
          break;
        case KeyEvent.VK_ENTER:
          dispose();
          actionOK();
          break;
        case KeyEvent.VK_SPACE:
          actionAdd();
          break;
        default:
          // keys.append((char) e.getKeyChar());
          list.ensureIndexIsVisible(list.getSelectedIndex());
      }

      //		if (debug)
      //			System.out.println("keys: " + keys);
      return;
    }

    switch (e.getKeyCode()) {
      case KeyEvent.VK_ENTER:
      case KeyEvent.VK_ESCAPE:
        dispose();
        break;
      default:
        break;
    }

    super.keyReleased(e);
  }