Source Code Cross Referenced for JDesktopPane.java in  » Apache-Harmony-Java-SE » javax-package » javax » swing » 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 » Apache Harmony Java SE » javax package » javax.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        package javax.swing;
019:
020:        import java.awt.Component;
021:        import java.util.ArrayList;
022:        import java.util.List;
023:        import javax.accessibility.Accessible;
024:        import javax.accessibility.AccessibleContext;
025:        import javax.accessibility.AccessibleRole;
026:        import javax.swing.plaf.DesktopPaneUI;
027:
028:        /**
029:         * <p>
030:         * <i>JDesktopPane</i> is a container used to create a virtual desktop.
031:         * </p>
032:         * <h3>Implementation Notes:</h3>
033:         * <ul>
034:         * <li>The <code>serialVersionUID</code> fields are explicitly declared as a performance
035:         * optimization, not as a guarantee of serialization compatibility.</li>
036:         * </ul>
037:         */
038:        public class JDesktopPane extends JLayeredPane implements  Accessible {
039:            private static final long serialVersionUID = -5428199090710889698L;
040:
041:            /**
042:             * Indicates that the entire content of the component should appear,
043:             * when it is being dragged.
044:             */
045:            public static final int LIVE_DRAG_MODE = 0;
046:
047:            /**
048:             * Indicates that an outline should appear instead of the entire content
049:             * of the component, when it is being dragged.
050:             */
051:            public static final int OUTLINE_DRAG_MODE = 1;
052:
053:            protected class AccessibleJDesktopPane extends AccessibleJComponent {
054:                private static final long serialVersionUID = -44586801937888192L;
055:
056:                protected AccessibleJDesktopPane() {
057:                    super ();
058:                }
059:
060:                @Override
061:                public AccessibleRole getAccessibleRole() {
062:                    return AccessibleRole.DESKTOP_PANE;
063:                }
064:            }
065:
066:            // The style of dragging to use.
067:            private int dragMode = LIVE_DRAG_MODE;
068:
069:            // The desktop manager.
070:            private DesktopManager desktopManager;
071:
072:            // The currently active internal frame.
073:            private JInternalFrame selectedFrame;
074:
075:            public JDesktopPane() {
076:                setFocusCycleRoot(true);
077:                updateUI();
078:            }
079:
080:            /**
081:             * Sets the UI object for this component.
082:             *
083:             * @param ui the UI object to set
084:             */
085:            public void setUI(final DesktopPaneUI ui) {
086:                // setUI() from super (JComponent) should always be called
087:                super .setUI(ui);
088:            }
089:
090:            /**
091:             * Returns the UI object for this component.
092:             *
093:             * @return UI object for this component
094:             */
095:            public DesktopPaneUI getUI() {
096:                return (DesktopPaneUI) ui;
097:            }
098:
099:            /**
100:             * Resets UI object with the default object from <code>UIManager</code>
101:             */
102:            @Override
103:            public void updateUI() {
104:                setUI((DesktopPaneUI) UIManager.getUI(this ));
105:            }
106:
107:            /*
108:             * Returns all internal frames in the array including iconified frames.
109:             */
110:            private JInternalFrame[] getAllFramesInArray(Component[] array) {
111:                List<JInternalFrame> result = new ArrayList<JInternalFrame>(
112:                        array.length);
113:                for (int i = 0; i < array.length; i++) {
114:                    if (array[i] instanceof  JInternalFrame) {
115:                        // internal frame
116:                        result.add((JInternalFrame) array[i]);
117:                    } else if (array[i] instanceof  JInternalFrame.JDesktopIcon) {
118:                        // iconified internal frame
119:                        result.add(((JInternalFrame.JDesktopIcon) array[i])
120:                                .getInternalFrame());
121:                    }
122:                }
123:                return result.toArray(new JInternalFrame[result.size()]);
124:            }
125:
126:            /**
127:             * Returns all internal frames in the specified layer. Iconified frames
128:             * are also taken into account.
129:             *
130:             * @param layer the layer to search for internal frames
131:             *
132:             * @return all internal frames in the specified layer
133:             */
134:            public JInternalFrame[] getAllFramesInLayer(final int layer) {
135:                return getAllFramesInArray(getComponentsInLayer(layer));
136:            }
137:
138:            /**
139:             * Returns all internal frames in the desktop pane including iconified
140:             * frames.
141:             *
142:             * @return all internal frames in the desktop pane
143:             */
144:            public JInternalFrame[] getAllFrames() {
145:                return getAllFramesInArray(getComponents());
146:            }
147:
148:            /**
149:             * Sets the currently active internal frame.
150:             *
151:             * @param f the currently active internal frame
152:             */
153:            public void setSelectedFrame(final JInternalFrame f) {
154:                selectedFrame = f;
155:            }
156:
157:            /**
158:             * Returns the currently active internal frame or <code>null</code>,
159:             * if there is no active frame.
160:             *
161:             * @return the currently active internal frame or <code>null</code>
162:             */
163:            public JInternalFrame getSelectedFrame() {
164:                return selectedFrame;
165:            }
166:
167:            /**
168:             * Sets the desktop manager.
169:             *
170:             * @param m the desktop manager
171:             */
172:            public void setDesktopManager(final DesktopManager m) {
173:                DesktopManager oldValue = getDesktopManager();
174:                desktopManager = m;
175:                firePropertyChange("desktopManager", oldValue, m);
176:            }
177:
178:            /**
179:             * Returns the desktop manager.
180:             *
181:             * @return the desktop manager
182:             */
183:            public DesktopManager getDesktopManager() {
184:                return desktopManager;
185:            }
186:
187:            /**
188:             * Returns the accessible context for the desktop pane.
189:             *
190:             * @return the accessible context for the desktop pane
191:             */
192:            @Override
193:            public AccessibleContext getAccessibleContext() {
194:                if (accessibleContext == null) {
195:                    accessibleContext = new AccessibleJDesktopPane();
196:                }
197:                return accessibleContext;
198:            }
199:
200:            /**
201:             * Returns string representation of this desktop pane.
202:             *
203:             * @return string representation of this desktop pane
204:             */
205:            @Override
206:            protected String paramString() {
207:                return super .paramString();
208:            }
209:
210:            /**
211:             * Returns the name of the L&F class that renders this component.
212:             *
213:             * @return the string "DesktopPaneUI"
214:             */
215:            @Override
216:            public String getUIClassID() {
217:                return "DesktopPaneUI";
218:            }
219:
220:            /**
221:             * Always returns true.
222:             *
223:             * @return <code>true</code>
224:             */
225:            @Override
226:            public boolean isOpaque() {
227:                return true;
228:            }
229:
230:            /**
231:             * Sets the style of dragging used by desktop pane.
232:             *
233:             * @param mode the style of dragging to use
234:             */
235:            public void setDragMode(final int mode) {
236:                LookAndFeel.markPropertyNotInstallable(this , "dragMode");
237:                dragMode = mode;
238:            }
239:
240:            /**
241:             * Returns the style of dragging used by desktop pane.
242:             *
243:             * @return the used style of dragging
244:             */
245:            public int getDragMode() {
246:                return dragMode;
247:            }
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.