@SuppressWarnings({ "unchecked", "rawtypes" })
    private ListDialog(Frame frame, Component locationComp, String labelText,
	    String title, Object[] data, String initialValue, String longValue) {
	super(frame, title, true);

	// Create and initialize the buttons.
	JButton cancelButton = new JButton(
		LanguagePropertyReader.get("btn_cancel"));
	cancelButton.addActionListener(this);
	//
	final JButton setButton = new JButton(
		LanguagePropertyReader.get("btn_ok"));
	setButton.setActionCommand("Set");
	setButton.addActionListener(this);
	getRootPane().setDefaultButton(setButton);

	// main part of the dialog
	list = new JList(data) {
	    /**
	     * 
	     */
	    private static final long serialVersionUID = -4068268261882373152L;

	    // Subclass JList to workaround bug 4832765, which can cause the
	    // scroll pane to not let the user easily scroll up to the beginning
	    // of the list. An alternative would be to set the unitIncrement
	    // of the JScrollBar to a fixed value. You wouldn't get the nice
	    // aligned scrolling, but it should work.
	    public int getScrollableUnitIncrement(Rectangle visibleRect,
		    int orientation, int direction) {
		int row;
		if (orientation == SwingConstants.VERTICAL && direction < 0
			&& (row = getFirstVisibleIndex()) != -1) {
		    Rectangle r = getCellBounds(row, row);
		    if ((r.y == visibleRect.y) && (row != 0)) {
			Point loc = r.getLocation();
			loc.y--;
			int prevIndex = locationToIndex(loc);
			Rectangle prevR = getCellBounds(prevIndex, prevIndex);

			if (prevR == null || prevR.y >= r.y) {
			    return 0;
			}
			return prevR.height;
		    }
		}
		return super.getScrollableUnitIncrement(visibleRect,
			orientation, direction);
	    }
	};

	list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
	if (longValue != null) {
	    list.setPrototypeCellValue(longValue); // get extra space
	}
	list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
	list.setVisibleRowCount(-1);
	list.addMouseListener(new MouseAdapter() {
	    public void mouseClicked(MouseEvent e) {
		if (e.getClickCount() == 2) {
		    setButton.doClick(); // emulate button click
		}
	    }
	});
	JScrollPane listScroller = new JScrollPane(list);
	listScroller.setPreferredSize(new Dimension(250, 80));
	listScroller.setAlignmentX(LEFT_ALIGNMENT);

	// Create a container so that we can add a title around
	// the scroll pane. Can't add a title directly to the
	// scroll pane because its background would be white.
	// Lay out the label and scroll pane from top to bottom.
	JPanel listPane = new JPanel();
	listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
	JLabel label = new JLabel(labelText);
	label.setLabelFor(list);
	listPane.add(label);
	listPane.add(Box.createRigidArea(new Dimension(0, 5)));
	listPane.add(listScroller);
	listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

	// Lay out the buttons from left to right.
	JPanel buttonPane = new JPanel();
	buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
	buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
	buttonPane.add(Box.createHorizontalGlue());
	buttonPane.add(cancelButton);
	buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
	buttonPane.add(setButton);

	// Put everything together, using the content pane's BorderLayout.
	Container contentPane = getContentPane();
	contentPane.add(listPane, BorderLayout.CENTER);
	contentPane.add(buttonPane, BorderLayout.PAGE_END);

	// Initialize values.
	setValue(initialValue);
	pack();
	setLocationRelativeTo(locationComp);
    }