get Focused Window - Java Swing

Java examples for Swing:Screen

Description

get Focused Window

Demo Code


//package com.java2s;

import java.awt.*;

public class Main {
    public static Window getFocusedWindow() {
        for (Window w : Window.getWindows()) {
            if (w.isFocused()) {
                return w;
            }/* ww w  .j a v  a  2s . co m*/
        }
        return null;
    }
}

Related Tutorials