Java tutorial
//package com.java2s; import javax.swing.*; import java.awt.*; public class Main { public static void printNow(int time, JComponent obj) { Dimension dim = obj.getSize(); obj.validate(); obj.paintImmediately(0, 0, dim.width, dim.height); try { Thread.sleep(time); } catch (InterruptedException e) { } } }