The object you pass as a JOptionPane message may be a graphical component, so something like this should work:
JPanel panel = new JPanel(); // Populate your panel components here. int ret = JOptionPane.showConfirmDialog(parent, panel, "Title", JOptionPane.YES_NO_OPTION); if ( ret == JOptionPane.YES_OPTION ) { // Read component values. }
source share