SwingToolkit.invokeNowOrLater(new Runnable() { public void run() { if (b) { jComponent.invalidate(); VMAwtAPI.invalidateTree(component); VMAwtAPI.invalidateTree(jComponent); jComponent.validate(); }  jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint(); } });
if (b) { VMAwtAPI.invalidateTree(component); VMAwtAPI.invalidateTree(jComponent); jComponent.validate(); }  jComponent.setVisible(b); jComponent.repaint(); toolkit.getAwtContext().getDesktop().repaint();
    public void setVisible(final boolean b) {        SwingToolkit.invokeNowOrLater(new Runnable() {            public void run() {                if (b) {                    jComponent.invalidate();                    VMAwtAPI.invalidateTree(component);                    VMAwtAPI.invalidateTree(jComponent);                    jComponent.validate();                }                jComponent.setVisible(b);                jComponent.repaint();                toolkit.getAwtContext().getDesktop().repaint();            }        });    }