Makes a window visible - if invisible - and brings it to front. - Java java.awt

Java examples for java.awt:Window

Description

Makes a window visible - if invisible - and brings it to front.

Demo Code


//package com.java2s;

import java.awt.Window;

public class Main {
    /**//from   w ww.  jav  a 2  s .c  om
     * Makes a window visible - if invisible - and brings it to front.
     *
     * @param window window
     */
    public static void show(Window window) {
        if (window == null) {
            throw new NullPointerException("window == null");
        }

        if (!window.isVisible()) {
            window.setVisible(true);
        }

        window.toFront();
    }
}

Related Tutorials