Here you can find the source of hideWaitPane(Window win, Timer timer)
public static void hideWaitPane(Window win, Timer timer)
//package com.java2s; //License from project: LGPL import java.awt.Component; import java.awt.Container; import java.awt.Window; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class Main { public static void hideWaitPane(Window win, Timer timer) { JPanel pane = new JPanel(); pane.setOpaque(false);// w ww . j av a 2 s .co m if (win instanceof JFrame) { JFrame frame = (JFrame) win; frame.setGlassPane(pane); } else if (win instanceof JDialog) { JDialog dialog = (JDialog) win; dialog.setGlassPane(pane); } else { throw new IllegalArgumentException("just JFrame and JDialog is support at present"); } pane.setVisible(false); if (timer != null) { timer.stop(); timer = null; } win.repaint(); } public static void setGlassPane(JComponent comp, Component glass, boolean visible) { Container container = comp.getTopLevelAncestor(); if (container instanceof JFrame) { JFrame frame = (JFrame) container; frame.setGlassPane(glass); } else if (container instanceof JDialog) { JDialog dialog = (JDialog) container; dialog.setGlassPane(glass); } else { throw new RuntimeException("unsupported top level ancestor!"); } glass.setVisible(visible); } }