public synchronized boolean show() {
        if (called) throw new IllegalStateException("Already shown");
        Integer value;
        do {
            d = p.createDialog(p.getParent(), title);
            if (minChoices != 0) d.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
            jList.setSelectedIndex(0);
            d.setVisible(true);
            d.dispose();
            value = (Integer) p.getValue();
            if (value == null || value != OK_OPTION) jList.clearSelection();
            //can't stop closing by ESC, so repeat if cancelled
        } while (minChoices != 0 && value != OK_OPTION);
        //this assert checks if we really don't return on a cancel if input is mandatory
        assert minChoices == 0 || value == OK_OPTION;
        called = true;
        return value != null && value == OK_OPTION;
    }