EditDialog(Editable ce, CircuitSimulator f) {
        super((Frame)null, "Edit Component", false);
        cframe = f;
        elm = ce;
        setLayout(new EditDialogLayout());
        einfos = new EditInfo[10];
        noCommaFormat = DecimalFormat.getInstance();
        noCommaFormat.setMaximumFractionDigits(10);
        noCommaFormat.setGroupingUsed(false);
        int i;
        for (i = 0;; i++) {
            einfos[i] = elm.getEditInfo(i);
            if (einfos[i] == null) {
                break;
            }
            EditInfo ei = einfos[i];
            add(new Label(ei.name));
            if (ei.choice != null) {
                add(ei.choice);
                ei.choice.addItemListener(this);
            } else if (ei.checkbox != null) {
                add(ei.checkbox);
                ei.checkbox.addItemListener(this);
            } else {
                add(ei.textf
                        = new TextField(unitString(ei), 10));
                if (ei.text != null) {
                    ei.textf.setText(ei.text);
                }
                ei.textf.addActionListener(this);
                if (ei.text == null) {
                    add(ei.bar = new Scrollbar(Scrollbar.HORIZONTAL,
                            50, 10, 0, barmax + 2));
                    setBar(ei);
                    ei.bar.addAdjustmentListener(this);
                }
            }
        }
        einfocount = i;
        add(applyButton = new Button("Apply"));
        applyButton.addActionListener(this);
        add(okButton = new Button("OK"));
        okButton.addActionListener(this);
        Point x = cframe.main.getLocationOnScreen();
        Dimension d = getSize();
        setLocation(x.x + (cframe.winSize.width - d.width) / 2,
                x.y + (cframe.winSize.height - d.height) / 2);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                closeDialog();
            }
        }
        );
    }