Here you can find the source of popupMessage(String title, String message)
public static void popupMessage(String title, String message)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.*; public class Main { /**// w w w . j a v a 2 s.co m * Gives the user a popup message with no icon. */ public static void popupMessage(String title, String message) { popupMessage(title, message, JOptionPane.PLAIN_MESSAGE); } /** * Gives a popup to the user. * @param icon The icon. You can use some of the constants in JOptionPane for this. */ @SuppressWarnings("WeakerAccess") public static void popupMessage(String title, String message, @SuppressWarnings("SameParameterValue") int icon) { Canvas frame = new Canvas(); JOptionPane.showMessageDialog(frame, message, title, icon); } }