1 /*
   2  * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.swing;
  26 
  27 
  28 import java.awt.Component;
  29 import java.awt.FocusTraversalPolicy;
  30 
  31 /**
  32  * A FocusTraversalPolicy which can optionally provide an algorithm for
  33  * determining a JInternalFrame's initial Component. The initial Component is
  34  * the first to receive focus when the JInternalFrame is first selected. By
  35  * default, this is the same as the JInternalFrame's default Component to
  36  * focus.
  37  *
  38  * @author David Mendenhall
  39  *
  40  * @since 1.4
  41  */
  42 public abstract class InternalFrameFocusTraversalPolicy
  43     extends FocusTraversalPolicy
  44 {
  45 
  46     /**
  47      * Returns the Component that should receive the focus when a
  48      * JInternalFrame is selected for the first time. Once the JInternalFrame
  49      * has been selected by a call to {@code setSelected(true)}, the
  50      * initial Component will not be used again. Instead, if the JInternalFrame
  51      * loses and subsequently regains selection, or is made invisible or
  52      * undisplayable and subsequently made visible and displayable, the
  53      * JInternalFrame's most recently focused Component will become the focus
  54      * owner. The default implementation of this method returns the
  55      * JInternalFrame's default Component to focus.
  56      *
  57      * @param frame the JInternalFrame whose initial Component is to be
  58      *        returned
  59      * @return the Component that should receive the focus when frame is
  60      *         selected for the first time, or null if no suitable Component
  61      *         can be found
  62      * @see JInternalFrame#getMostRecentFocusOwner
  63      * @throws IllegalArgumentException if window is null
  64      */
  65     public Component getInitialComponent(JInternalFrame frame) {
  66         return getDefaultComponent(frame);
  67     }
  68 }