public static int showOptionDialog(Component parentComponent, Object message, String title, boolean resizable, int optionType, int messageType, Icon icon, Object[] options, Object initialValue) {
		JOptionPane pane = new JOptionPane(message, messageType, optionType, icon, options, initialValue);
		pane.setUI(new SizeAwareBasicOptionPaneUI(pane.getUI()));
		pane.setInitialValue(initialValue);
		pane.setComponentOrientation((parentComponent == null ? JOptionPane.getRootFrame() : parentComponent).getComponentOrientation());

		final JDialog dialog = pane.createDialog(getWindowForComponent(parentComponent), title);
		WindowSizeEnforcer.monitor(dialog);
		pane.selectInitialValue();
		dialog.setResizable(resizable);
		final Component field = getFirstFocusableField(message);
		if (field != null) {
			dialog.addWindowFocusListener(new WindowAdapter() {
				@Override
				public void windowGainedFocus(WindowEvent event) {
					field.requestFocus();
					dialog.removeWindowFocusListener(this);
				}
			});
		}
		dialog.setVisible(true);
		dialog.dispose();
		pane.setMessage(null);

		Object selectedValue = pane.getValue();
		if (selectedValue != null) {
			if (options == null) {
				if (selectedValue instanceof Integer) {
					return ((Integer) selectedValue).intValue();
				}
			} else {
				for (int i = 0; i < options.length; i++) {
					if (options[i].equals(selectedValue)) {
						return i;
					}
				}
			}
		}
		return JOptionPane.CLOSED_OPTION;
	}