Returns the window that is currently the focus owner. - Java Swing

Java examples for Swing:JWindow

Description

Returns the window that is currently the focus owner.

Demo Code


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

public class Main {
    /**//from   w w  w .  j a  v  a  2 s.  c om
     * Returns the window that is currently the focus owner. May be null if no
     * window owns the focus.
     * @return The window that currently owns the focus, or null.
     */
    static public Window focusedWindow() {
        return KeyboardFocusManager.getCurrentKeyboardFocusManager()
                .getFocusedWindow();
    }
}

Related Tutorials