public static Object DoShowOptionDialog( Component frame, String msg, String title, int opt_type, int msg_type, Icon icon, Object[] opts, Object init) { JOptionPane p = new JOptionPane(msg, msg_type, opt_type, icon, opts, init); System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " + p.msg); JDialog a; if (frame == null) { a = new JDialog((Frame) frame, title, true); } else if (frame instanceof Dialog) { a = new JDialog((Dialog) frame, title, true); } else if (frame instanceof Frame) { a = new JDialog((Frame) frame, title, true); } else { System.out.println("HUUUUHHH, not a frame or dialog !"); a = new JDialog((Frame) null, title, true); } p.dialog = a; a.getContentPane().setLayout(new BorderLayout()); a.getContentPane().add(p, BorderLayout.CENTER); // package the deal a.pack(); a.setVisible(true); Object s = p.getValue(); System.out.println("RESULT FROM DIALOG = " + s); if (s == null) return null; return s; }