Java Swing Focus installFocusCycleRoot(Container c, FocusTraversalPolicy cyclePolicy)

Here you can find the source of installFocusCycleRoot(Container c, FocusTraversalPolicy cyclePolicy)

Description

installs a focus cycle, its keys and the (optional) policy

License

Open Source License

Declaration

public static void installFocusCycleRoot(Container c, FocusTraversalPolicy cyclePolicy) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://w  w w. j a  v  a 2 s . c  o  m
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

import java.awt.Container;

import java.awt.FocusTraversalPolicy;

import javax.swing.RootPaneContainer;

public class Main {
    /**
     * installs a focus cycle, its keys and the (optional) policy
     */
    public static void installFocusCycleRoot(Container c, FocusTraversalPolicy cyclePolicy) {
        c.setFocusCycleRoot(true);
        c.setFocusTraversalPolicy(cyclePolicy);
        if (c instanceof RootPaneContainer) {
            Container contentPane = ((RootPaneContainer) c).getContentPane();
            if (contentPane != null) {
                contentPane.setFocusTraversalPolicy(null);
                contentPane.setFocusCycleRoot(false);
            }
        }
    }
}

Related

  1. getFocusableComponentOrChild(Component c, boolean deepest)
  2. getPermanentFocusOwner()
  3. hasFocus(Component component)
  4. hasFocusOwner(final Component component)
  5. installDefaultFocusHandling(Container c)
  6. installJComponentRepainterOnWindowFocusChanged( JComponent component)
  7. installJComponentRepainterOnWindowFocusChanged(JComponent component)
  8. installJComponentRepainterOnWindowFocusChanged(JComponent component)
  9. isDescendingFrom(Component focusOwner, Component parent)