Source Code Cross Referenced for FocusTraversalPolicy.java in  » 6.0-JDK-Modules » j2me » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.awt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * 
003:         * Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
004:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
005:         * 
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License version
008:         * 2 only, as published by the Free Software Foundation. 
009:         * 
010:         * This program is distributed in the hope that it will be useful, but
011:         * WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * General Public License version 2 for more details (a copy is
014:         * included at /legal/license.txt). 
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * version 2 along with this work; if not, write to the Free Software
018:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019:         * 02110-1301 USA 
020:         * 
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
022:         * Clara, CA 95054 or visit www.sun.com if you need additional
023:         * information or have any questions. 
024:         */
025:        package java.awt;
026:
027:        /**
028:         * A FocusTraversalPolicy defines the order in which Components with a
029:         * particular focus cycle root are traversed. Instances can apply the policy to
030:         * arbitrary focus cycle roots, allowing themselves to be shared across
031:         * Containers. They do not need to be reinitialized when the focus cycle roots
032:         * of a Component hierarchy change.
033:         * <p>
034:         * The core responsibility of a FocusTraversalPolicy is to provide algorithms
035:         * determining the next and previous Components to focus when traversing
036:         * forward or backward in a UI. Each FocusTraversalPolicy must also provide
037:         * algorithms for determining the first, last, and default Components in a
038:         * traversal cycle. First and last Components are used when normal forward and
039:         * backward traversal, respectively, wraps. The default Component is the first
040:         * to receive focus when traversing down into a new focus traversal cycle.
041:         * A FocusTraversalPolicy can optionally provide an algorithm for determining
042:         * a Window's initial Component. The initial Component is the first to receive
043:         * focus when a Window is first made visible.
044:         *
045:         * @author David Mendenhall
046:         * @version 1.4, 01/23/03
047:         *
048:         * @see Container#setFocusTraversalPolicy
049:         * @see Container#getFocusTraversalPolicy
050:         * @see KeyboardFocusManager#setDefaultFocusTraversalPolicy
051:         * @see KeyboardFocusManager#getDefaultFocusTraversalPolicy
052:         * @since 1.4
053:         */
054:        public abstract class FocusTraversalPolicy {
055:            /**
056:             * Returns the Component that should receive the focus after aComponent.
057:             * focusCycleRoot must be a focus cycle root of aComponent.
058:             *
059:             * @param focusCycleRoot a focus cycle root of aComponent
060:             * @param aComponent a (possibly indirect) child of focusCycleRoot, or
061:             *        focusCycleRoot itself
062:             * @return the Component that should receive the focus after aComponent, or
063:             *         null if no suitable Component can be found
064:             * @throws IllegalArgumentException if focusCycleRoot is not a focus cycle
065:             *         root of aComponent, or if either focusCycleRoot or aComponent is
066:             *         null
067:             */
068:            public abstract Component getComponentAfter(
069:                    Container focusCycleRoot, Component aComponent);
070:
071:            /**
072:             * Returns the Component that should receive the focus before aComponent.
073:             * focusCycleRoot must be a focus cycle root of aComponent.
074:             *
075:             * @param focusCycleRoot a focus cycle root of aComponent
076:             * @param aComponent a (possibly indirect) child of focusCycleRoot, or
077:             *        focusCycleRoot itself
078:             * @return the Component that should receive the focus before aComponent,
079:             *         or null if no suitable Component can be found
080:             * @throws IllegalArgumentException if focusCycleRoot is not a focus cycle
081:             *         root of aComponent, or if either focusCycleRoot or aComponent is
082:             *         null
083:             */
084:            public abstract Component getComponentBefore(
085:                    Container focusCycleRoot, Component aComponent);
086:
087:            /**
088:             * Returns the first Component in the traversal cycle. This method is used
089:             * to determine the next Component to focus when traversal wraps in the
090:             * forward direction.
091:             *
092:             * @param focusCycleRoot the focus cycle root whose first Component is to
093:             *        be returned
094:             * @return the first Component in the traversal cycle when focusCycleRoot
095:             *         is the focus cycle root, or null if no suitable Component can be
096:             *         found
097:             * @throws IllegalArgumentException if focusCycleRoot is null
098:             */
099:            public abstract Component getFirstComponent(Container focusCycleRoot);
100:
101:            /**
102:             * Returns the last Component in the traversal cycle. This method is used
103:             * to determine the next Component to focus when traversal wraps in the
104:             * reverse direction.
105:             *
106:             * @param focusCycleRoot the focus cycle root whose last Component is to be
107:             *         returned
108:             * @return the last Component in the traversal cycle when focusCycleRoot is
109:             *         the focus cycle root, or null if no suitable Component can be
110:             *         found
111:             * @throws IllegalArgumentException if focusCycleRoot is null
112:             */
113:            public abstract Component getLastComponent(Container focusCycleRoot);
114:
115:            /**
116:             * Returns the default Component to focus. This Component will be the first
117:             * to receive focus when traversing down into a new focus traversal cycle
118:             * rooted at focusCycleRoot.
119:             *
120:             * @param focusCycleRoot the focus cycle root whose default Component is to
121:             *        be returned
122:             * @return the default Component in the traversal cycle when focusCycleRoot
123:             *         is the focus cycle root, or null if no suitable Component can
124:             *         be found
125:             * @throws IllegalArgumentException if focusCycleRoot is null
126:             */
127:            public abstract Component getDefaultComponent(
128:                    Container focusCycleRoot);
129:
130:            /**
131:             * Returns the Component that should receive the focus when a Window is
132:             * made visible for the first time. Once the Window has been made visible
133:             * by a call to <code>show()</code> or <code>setVisible(true)</code>, the
134:             * initial Component will not be used again. Instead, if the Window loses
135:             * and subsequently regains focus, or is made invisible or undisplayable
136:             * and subsequently made visible and displayable, the Window's most
137:             * recently focused Component will become the focus owner. The default
138:             * implementation of this method returns the default Component.
139:             *
140:             * @param window the Window whose initial Component is to be returned
141:             * @return the Component that should receive the focus when window is made
142:             *         visible for the first time, or null if no suitable Component can
143:             *         be found
144:             * @see #getDefaultComponent
145:             * @see Window#getMostRecentFocusOwner
146:             * @throws IllegalArgumentException if window is null
147:             */
148:            public Component getInitialComponent(Window window) {
149:                if (window == null) {
150:                    throw new IllegalArgumentException(
151:                            "window cannot be equal to null.");
152:                }
153:                Component def = getDefaultComponent(window);
154:                if (def == null && window.isFocusableWindow()) {
155:                    def = window;
156:                }
157:                return def;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.