Invalidates, validates and repaint a component. - Java java.awt

Java examples for java.awt:Component

Description

Invalidates, validates and repaint a component.

Demo Code


//package com.java2s;
import java.awt.Component;

public class Main {
    /**//from w  ww .  java2 s .  c  o m
     * Invalidates, validates and repaint a component.
     *
     * @param component component
     */
    public static void forceRepaint(Component component) {
        if (component == null) {
            throw new NullPointerException("component == null");
        }

        component.invalidate();
        component.validate();
        component.repaint();
    }
}

Related Tutorials