src/share/classes/javax/swing/SortingFocusTraversalPolicy.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2013, 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


 590         return comparator;
 591     }
 592 
 593     /**
 594      * Determines whether a Component is an acceptable choice as the new
 595      * focus owner. By default, this method will accept a Component if and
 596      * only if it is visible, displayable, enabled, and focusable.
 597      *
 598      * @param aComponent the Component whose fitness as a focus owner is to
 599      *        be tested
 600      * @return <code>true</code> if aComponent is visible, displayable,
 601      *         enabled, and focusable; <code>false</code> otherwise
 602      */
 603     protected boolean accept(Component aComponent) {
 604         return fitnessTestPolicy.accept(aComponent);
 605     }
 606 }
 607 
 608 // Create our own subclass and change accept to public so that we can call
 609 // accept.

 610 class SwingContainerOrderFocusTraversalPolicy
 611     extends java.awt.ContainerOrderFocusTraversalPolicy
 612 {
 613     public boolean accept(Component aComponent) {
 614         return super.accept(aComponent);
 615     }
 616 }
   1 /*
   2  * Copyright (c) 2000, 2014, 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


 590         return comparator;
 591     }
 592 
 593     /**
 594      * Determines whether a Component is an acceptable choice as the new
 595      * focus owner. By default, this method will accept a Component if and
 596      * only if it is visible, displayable, enabled, and focusable.
 597      *
 598      * @param aComponent the Component whose fitness as a focus owner is to
 599      *        be tested
 600      * @return <code>true</code> if aComponent is visible, displayable,
 601      *         enabled, and focusable; <code>false</code> otherwise
 602      */
 603     protected boolean accept(Component aComponent) {
 604         return fitnessTestPolicy.accept(aComponent);
 605     }
 606 }
 607 
 608 // Create our own subclass and change accept to public so that we can call
 609 // accept.
 610 @SuppressWarnings("serial") // JDK-implementation class
 611 class SwingContainerOrderFocusTraversalPolicy
 612     extends java.awt.ContainerOrderFocusTraversalPolicy
 613 {
 614     public boolean accept(Component aComponent) {
 615         return super.accept(aComponent);
 616     }
 617 }