private void initDialog(final JDialog dialog, int style, Frame parent) {
		dialog.setComponentOrientation(this.getComponentOrientation());
		Container contentPane = dialog.getContentPane();

		contentPane.setLayout(new BorderLayout());
		contentPane.add(this, BorderLayout.CENTER);
		dialog.setResizable(false);
//		if (JDialog.isDefaultLookAndFeelDecorated()) {
//			boolean supportsWindowDecorations =
//					UIManager.getLookAndFeel().getSupportsWindowDecorations();
//			if (supportsWindowDecorations) {
		dialog.setUndecorated(true);
//				getRootPane().setWindowDecorationStyle(style);
//			}
//		}
		dialog.pack();
		dialog.setLocationRelativeTo(parent);

		final PropertyChangeListener listener = new PropertyChangeListener() {

			public void propertyChange(PropertyChangeEvent event) {
				// Let the defaultCloseOperation handle the closing
				// if the user closed the window without selecting a button
				// (newValue = null in that case).  Otherwise, close the dialog.
				if (dialog.isVisible() && event.getSource() == Dialog.this
						&& (event.getPropertyName().equals(VALUE_PROPERTY))
						&& event.getNewValue() != null
						&& event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
					dialog.setVisible(false);
				}
			}
		};

		WindowAdapter adapter = new WindowAdapter() {

			private boolean gotFocus = false;

			public void windowClosing(WindowEvent we) {
				setValue(null);
			}

			public void windowClosed(WindowEvent e) {
				removePropertyChangeListener(listener);
				dialog.getContentPane().removeAll();
			}

			public void windowGainedFocus(WindowEvent we) {
				// Once window gets focus, set initial focus
				if (!gotFocus) {
					selectInitialValue();
					gotFocus = true;
				}
			}
		};
		dialog.addWindowListener(adapter);
		dialog.addWindowFocusListener(adapter);
		dialog.addComponentListener(new ComponentAdapter() {

			public void componentShown(ComponentEvent ce) {
				// reset value to ensure closing works properly
				setValue(JOptionPane.UNINITIALIZED_VALUE);
			}
		});

		addPropertyChangeListener(listener);
	}