Here you can find the source of setWinVisible(final JFrame win, final boolean vis)
public static void setWinVisible(final JFrame win, final boolean vis)
//package com.java2s; //License from project: Open Source License import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class Main { public static void setWinVisible(final JFrame win, final boolean vis) { SwingUtilities.invokeLater(new Runnable() { public void run() { win.setVisible(vis);//from w w w. java 2 s . c o m } }); } public static void setWinVisible(final JDialog win, final boolean vis) { SwingUtilities.invokeLater(new Runnable() { public void run() { win.setVisible(vis); } }); } }