Java Swing Focus containerContainsFocus(Container cont)

Here you can find the source of containerContainsFocus(Container cont)

Description

container Contains Focus

License

Open Source License

Declaration

public static boolean containerContainsFocus(Container cont)
        

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Component;

import java.awt.Container;

import java.awt.KeyboardFocusManager;

import javax.swing.SwingUtilities;

public class Main {
    public static boolean containerContainsFocus(Container cont)
    /*      */{/*w  w  w .j  av a  2 s .  co m*/
        /* 2298 */Component focusOwner = KeyboardFocusManager
                .getCurrentKeyboardFocusManager().getFocusOwner();
        /*      */
        /* 2300 */Component permFocusOwner = KeyboardFocusManager
                .getCurrentKeyboardFocusManager().getPermanentFocusOwner();
        /*      */
        /* 2303 */boolean focusOwned = (focusOwner != null)
                && (SwingUtilities.isDescendingFrom(focusOwner, cont));
        /* 2304 */if (!focusOwned) {
            /* 2305 */focusOwned = (permFocusOwner != null)
                    && (SwingUtilities.isDescendingFrom(permFocusOwner,
                            cont));
            /*      */}
        /*      */
        /* 2308 */return focusOwned;
        /*      */}
}

Related

  1. adjustFocus(JComponent c)
  2. centreInFocusedWindow(Window window, int xOffset, int yOffset)
  3. checkComponentsFocusable(final Component _rootComponent)
  4. clearAWTFocus(Robot robot)
  5. compositeRequestFocus(Component component)
  6. containerContainsFocus(Container cont)
  7. createWizardFocusAdapter()
  8. focusComponent(Component comp)
  9. focusComponentOrChild(Component c)