ScrollPane scroller = new ScrollPane();
    private void initialize(JFrame parent,                            String question, String[] choices,                            boolean isSingle) {        super.setResizable(false);        GridBagLayout gridbag = new GridBagLayout();        getContentPane().setLayout(gridbag);        GridBagConstraints c = new GridBagConstraints();        c.gridwidth = 1;        c.gridheight = 1;        c.gridx = 0;        // Display the question in a scrollable, uneditable area.        JTextArea message = new JTextArea(question, 5, 50);        message.setEditable(false);        c.gridy = 0;        c.insets = new Insets(0, 5, 0, 5);        getContentPane().add(new JScrollPane(message), c);        // Do we have any choices?        if (choices != null && choices.length > 0) {            // Display the choices as a single column of radio buttons.            // The first checkbox is selected by default.            JPanel choiceArea = new JPanel(new GridLayout(0, 1));            c.gridy++;            c.insets = new Insets(0, 5, 0, 5);            // If there are many choices, display them in a scroll pane.            GridBagConstraints center = new GridBagConstraints();            center.anchor = GridBagConstraints.CENTER;            if (choices.length > 5) {                // Save the current value of c.fill; change it to HORIZONTAL.                int saveFill = c.fill;                c.fill = GridBagConstraints.HORIZONTAL;                // Place the choice area in the center                // of another panel that is scrolled.                ScrollPane scroller = new ScrollPane();                JPanel scrollee = new JPanel(new GridBagLayout());                scrollee.add(choiceArea, center);                scroller.add(scrollee);                getContentPane().add(scroller, c);                // Restore the saved value of c.fill.                c.fill = saveFill;            } else {                getContentPane().add(choiceArea, c);            }            // Single choice dialogs use radio buttons.            checkboxes = new JCheckBox[choices.length];            if (isSingle) {                ButtonGroup radioGroup = new ButtonGroup();                for (int loop = 0; loop < choices.length; loop++) {                    checkboxes[loop] = new JRadioButton(choices[loop],                            loop == 0);                    radioGroup.add(checkboxes[loop]);                    choiceArea.add(checkboxes[loop]);                }            }            // All others use check boxes.            else {                for (int loop = 0; loop < choices.length; loop++) {                    checkboxes[loop] = new JCheckBox(choices[loop],                            loop == 0);                    choiceArea.add(checkboxes[loop]);                }                // If this is not a single-choice dialog, place the                // "select all" and "clear all" buttons in a row                // under the  scrollable area.                GridLayout grid = new GridLayout(1, 0);                grid.setHgap(20);                JPanel panAllButtons = new JPanel(grid);                panAllButtons.add(butSelectAll);                butSelectAll.addActionListener(this);                panAllButtons.add(butClearAll);                butClearAll.addActionListener(this);                getContentPane().add(panAllButtons, center);            }        } // End have-choices        // Allow the player to confirm or abort the choice.        setupButtons();        c.gridy++;        c.insets = new Insets(5, 5, 5, 5);        getContentPane().add(panButtons, c);        butOK.requestFocus();        addWindowListener(new WindowAdapter() {            public void windowClosing(WindowEvent e) {                setVisible(false);            }        });        pack();        Dimension size = getSize();        boolean updateSize = false;        if (size.width < GUIPreferences.getInstance().getMinimumSizeWidth()) {            size.width = GUIPreferences.getInstance().getMinimumSizeWidth();        }        if (size.height < GUIPreferences.getInstance().getMinimumSizeHeight()) {            size.height = GUIPreferences.getInstance().getMinimumSizeHeight();        }        if (updateSize) {            setSize(size);            size = getSize();        }        setLocation(parent.getLocation().x + parent.getSize().width / 2 - size.width / 2,                parent.getLocation().y + parent.getSize().height / 2 - size.height / 2);    }