Java Swing Focus isParentWindowFocused(Component component)

Here you can find the source of isParentWindowFocused(Component component)

Description

is Parent Window Focused

License

Open Source License

Declaration

public static boolean isParentWindowFocused(Component component) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Zeljko Zirikovic./* ww w  .  ja  v  a  2s.com*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GPL which 
 * accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 ******************************************************************************/

import java.awt.Component;
import java.awt.Window;

import javax.swing.SwingUtilities;

public class Main {
    public static boolean isParentWindowFocused(Component component) {
        Window window = SwingUtilities.getWindowAncestor(component);
        return window != null && window.isFocused();
    }
}

Related

  1. installJComponentRepainterOnWindowFocusChanged(JComponent component)
  2. isDescendingFrom(Component focusOwner, Component parent)
  3. isFocusable(Component component)
  4. isFocused(Component component)
  5. isFocused(Component component, boolean recoursive)
  6. isParentWindowFocused(Component component)
  7. isParentWindowFocused(Component component)
  8. paintFocusRect(Graphics g, Rectangle r)
  9. postponeFocus(final Component target)