Here you can find the source of showMsg(final Container parent, final String message)
public static void showMsg(final Container parent, final String message) throws HeadlessException
//package com.java2s; //License from project: Apache License import java.awt.Container; import java.awt.HeadlessException; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class Main { public static void showMsg(final Container parent, final String message) throws HeadlessException { SwingUtilities.invokeLater(new Runnable() { @Override//from w w w . ja va2 s. c o m public void run() { JOptionPane.showMessageDialog(parent, message, UIManager.getString("OptionPane.messageDialogTitle"), JOptionPane.INFORMATION_MESSAGE); } }); } }