Source Code Cross Referenced for FocusManager.java in  » 6.0-JDK-Core » swing » javax » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1997-2004 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        package javax.swing;
026
027        import java.awt.*;
028
029        /**
030         * This class has been obsoleted by the 1.4 focus APIs. While client code may
031         * still use this class, developers are strongly encouraged to use
032         * <code>java.awt.KeyboardFocusManager</code> and
033         * <code>java.awt.DefaultKeyboardFocusManager</code> instead.
034         * <p>
035         * Please see
036         * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html">
037         * How to Use the Focus Subsystem</a>,
038         * a section in <em>The Java Tutorial</em>, and the
039         * <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
040         * for more information.
041         *
042         * @see <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
043         *
044         * @version 1.35, 05/05/07
045         * @author Arnaud Weber
046         * @author David Mendenhall
047         */
048        public abstract class FocusManager extends DefaultKeyboardFocusManager {
049
050            /**
051             * This field is obsolete, and its use is discouraged since its
052             * specification is incompatible with the 1.4 focus APIs.
053             * The current FocusManager is no longer a property of the UI.
054             * Client code must query for the current FocusManager using
055             * <code>KeyboardFocusManager.getCurrentKeyboardFocusManager()</code>.
056             * See the Focus Specification for more information.
057             *
058             * @see java.awt.KeyboardFocusManager#getCurrentKeyboardFocusManager
059             * @see <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
060             */
061            public static final String FOCUS_MANAGER_CLASS_PROPERTY = "FocusManagerClassName";
062
063            private static boolean enabled = true;
064
065            /**
066             * Returns the current <code>KeyboardFocusManager</code> instance
067             * for the calling thread's context.
068             *
069             * @return this thread's context's <code>KeyboardFocusManager</code>
070             * @see #setCurrentManager
071             */
072            public static FocusManager getCurrentManager() {
073                KeyboardFocusManager manager = KeyboardFocusManager
074                        .getCurrentKeyboardFocusManager();
075                if (manager instanceof  FocusManager) {
076                    return (FocusManager) manager;
077                } else {
078                    return new DelegatingDefaultFocusManager(manager);
079                }
080            }
081
082            /**
083             * Sets the current <code>KeyboardFocusManager</code> instance
084             * for the calling thread's context. If <code>null</code> is
085             * specified, then the current <code>KeyboardFocusManager</code>
086             * is replaced with a new instance of
087             * <code>DefaultKeyboardFocusManager</code>.
088             * <p>
089             * If a <code>SecurityManager</code> is installed,
090             * the calling thread must be granted the <code>AWTPermission</code>
091             * "replaceKeyboardFocusManager" in order to replace the
092             * the current <code>KeyboardFocusManager</code>.
093             * If this permission is not granted,
094             * this method will throw a <code>SecurityException</code>,
095             * and the current <code>KeyboardFocusManager</code> will be unchanged.
096             *
097             * @param aFocusManager the new <code>KeyboardFocusManager</code>
098             *     for this thread's context
099             * @see #getCurrentManager
100             * @see java.awt.DefaultKeyboardFocusManager
101             * @throws SecurityException if the calling thread does not have permission
102             *         to replace the current <code>KeyboardFocusManager</code>
103             */
104            public static void setCurrentManager(FocusManager aFocusManager)
105                    throws SecurityException {
106                // Note: This method is not backward-compatible with 1.3 and earlier
107                // releases. It now throws a SecurityException in an applet, whereas
108                // in previous releases, it did not. This issue was discussed at
109                // length, and ultimately approved by Hans.
110                KeyboardFocusManager toSet = (aFocusManager instanceof  DelegatingDefaultFocusManager) ? ((DelegatingDefaultFocusManager) aFocusManager)
111                        .getDelegate()
112                        : aFocusManager;
113                KeyboardFocusManager.setCurrentKeyboardFocusManager(toSet);
114            }
115
116            /**
117             * Changes the current <code>KeyboardFocusManager</code>'s default
118             * <code>FocusTraversalPolicy</code> to
119             * <code>DefaultFocusTraversalPolicy</code>.
120             *
121             * @see java.awt.DefaultFocusTraversalPolicy
122             * @see java.awt.KeyboardFocusManager#setDefaultFocusTraversalPolicy
123             * @deprecated as of 1.4, replaced by 
124             * <code>KeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy)</code>
125             */
126            @Deprecated
127            public static void disableSwingFocusManager() {
128                if (enabled) {
129                    enabled = false;
130                    KeyboardFocusManager.getCurrentKeyboardFocusManager()
131                            .setDefaultFocusTraversalPolicy(
132                                    new DefaultFocusTraversalPolicy());
133                }
134            }
135
136            /**
137             * Returns whether the application has invoked
138             * <code>disableSwingFocusManager()</code>.
139             *
140             * @see #disableSwingFocusManager
141             * @deprecated As of 1.4, replaced by
142             *   <code>KeyboardFocusManager.getDefaultFocusTraversalPolicy()</code>
143             */
144            @Deprecated
145            public static boolean isFocusManagerEnabled() {
146                return enabled;
147            }
148        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.