Example usage for javax.swing FocusManager getCurrentManager

List of usage examples for javax.swing FocusManager getCurrentManager

Introduction

In this page you can find the example usage for javax.swing FocusManager getCurrentManager.

Prototype

public static FocusManager getCurrentManager() 

Source Link

Document

Returns the current KeyboardFocusManager instance for the calling thread's context.

Usage

From source file:Main.java

/**
 * Returns whether component or any of its children has focus or not.
 *
 * @param component/*from w ww  .  j a  va 2  s.c o m*/
 *            component to process
 * @return true if component or any of its children has focus, false
 *         otherwise
 */
public static boolean hasFocusOwner(final Component component) {
    final Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
    return component == focusOwner
            || component instanceof Container && ((Container) component).isAncestorOf(focusOwner);
}

From source file:net.landora.video.utils.UIUtils.java

public static Component getActiveWindow() {
    return FocusManager.getCurrentManager().getActiveWindow();
}