Here you can find the source of showWarning(final String message)
private static void showWarning(final String message)
//package com.java2s; /*/*from www.ja v a 2s . c o m*/ * IconUtils.java * * Copyright (c) 2009 JAM Development Team * * This package is distributed under the Lesser Gnu Public Licence (LGPL) * */ import javax.swing.*; import java.awt.*; import java.lang.reflect.InvocationTargetException; public class Main { private static void showWarning(final String message) { if (EventQueue.isDispatchThread()) { JOptionPane.showMessageDialog(null, message, "Warning", JOptionPane.WARNING_MESSAGE); } else { // must show message dialog in the event dispatch thread, otherwise can crash try { EventQueue.invokeAndWait(new Runnable() { public void run() { JOptionPane.showMessageDialog(null, message, "Warning", JOptionPane.WARNING_MESSAGE); } }); } catch (InterruptedException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }