JPanel
is simply a container used to house other components.
JDialog
is a general purpose dialog which can be customized by adding other components. (See How to add components to JDialog for more on this)
JOptionPane
can be thought of as a special purpose dialog. From the javadoc (emphasis added):
JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something.
If you dig into the source for JOptionPane
you'll find that the methods like showInputDialog()
actually create a JDialog
, then populate it with the JOptionPane
public static Object showInputDialog(Component parentComponent,
Object message, String title, int messageType, Icon icon,
Object[] selectionValues, Object initialSelectionValue)
throws HeadlessException {
JOptionPane pane = new JOptionPane(message, messageType,
OK_CANCEL_OPTION, icon,
null, null);
pane.setWantsInput(true);
pane.setSelectionValues(selectionValues);
pane.setInitialSelectionValue(initialSelectionValue);
pane.setComponentOrientation(((parentComponent == null) ?
getRootFrame() : parentComponent).getComponentOrientation());
int style = styleFromMessageType(messageType);
JDialog dialog = pane.createDialog(parentComponent, title, style);
pane.selectInitialValue();
dialog.show();
dialog.dispose();
Object value = pane.getInputValue();
if (value == UNINITIALIZED_VALUE) {
return null;
}
return value;
}
Based on your description, it sounds like you could use JOptionPane.showConfirmDialog()
to acknowledge that a user has been added.
During your application's think time, you might want to pair a progress bar with a JDialog
to let the use know the system is working.
If you post example code, the community members here can probably give you more specific guidance on how to best make use of these components within your application.