Following code segments shows how to display a message dialog in Java Swing: import javax.swing.JOptionPane; JOptionPane.showMessageDialog(mainFrame, "Data processing has been completed"); where, mainFrame = the parent frame in which the dialog should be displayed. mainFrame can also be replaced with null.
At times, we need to show quick messages in a small window on screen to users in Java. Here is a quick way to do this. import javax.swing.JOptionPane JOptionPane.showMessageDialog(null, "This is my Message Dialog");