Source Code Cross Referenced for MacOSXStatusBarUI.java in  » Swing-Library » swingx » org » jdesktop » swingx » plaf » macosx » 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 » Swing Library » swingx » org.jdesktop.swingx.plaf.macosx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: MacOSXStatusBarUI.java,v 1.5 2007/02/08 05:12:15 rbair Exp $
003:         *
004:         * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005:         * Santa Clara, California 95054, U.S.A. All rights reserved.
006:         *
007:         * This library is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU Lesser General Public
009:         * License as published by the Free Software Foundation; either
010:         * version 2.1 of the License, or (at your option) any later version.
011:         * 
012:         * This library is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         * Lesser General Public License for more details.
016:         * 
017:         * You should have received a copy of the GNU Lesser General Public
018:         * License along with this library; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020:         */
021:
022:        package org.jdesktop.swingx.plaf.macosx;
023:
024:        import java.awt.FlowLayout;
025:        import java.awt.LayoutManager;
026:        import javax.swing.BorderFactory;
027:        import javax.swing.JComponent;
028:        import javax.swing.border.Border;
029:        import javax.swing.plaf.BorderUIResource;
030:        import javax.swing.plaf.ComponentUI;
031:        import javax.swing.plaf.UIResource;
032:        import org.jdesktop.swingx.JXStatusBar;
033:        import org.jdesktop.swingx.plaf.StatusBarUI;
034:
035:        /**
036:         *
037:         * @author rbair
038:         */
039:        public class MacOSXStatusBarUI extends StatusBarUI {
040:            /**
041:             * The one and only JXStatusBar for this UI delegate
042:             */
043:            private JXStatusBar statusBar;
044:
045:            /** Creates a new instance of BasicStatusBarUI */
046:            public MacOSXStatusBarUI() {
047:            }
048:
049:            /**
050:             * Returns an instance of the UI delegate for the specified component.
051:             * Each subclass must provide its own static <code>createUI</code>
052:             * method that returns an instance of that UI delegate subclass.
053:             * If the UI delegate subclass is stateless, it may return an instance
054:             * that is shared by multiple components.  If the UI delegate is
055:             * stateful, then it should return a new instance per component.
056:             * The default implementation of this method throws an error, as it
057:             * should never be invoked.
058:             */
059:            public static ComponentUI createUI(JComponent c) {
060:                return new MacOSXStatusBarUI();
061:            }
062:
063:            /**
064:             * Configures the specified component appropriate for the look and feel.
065:             * This method is invoked when the <code>ComponentUI</code> instance is being installed
066:             * as the UI delegate on the specified component.  This method should
067:             * completely configure the component for the look and feel,
068:             * including the following:
069:             * <ol>
070:             * <li>Install any default property values for color, fonts, borders,
071:             *     icons, opacity, etc. on the component.  Whenever possible, 
072:             *     property values initialized by the client program should <i>not</i> 
073:             *     be overridden.
074:             * <li>Install a <code>LayoutManager</code> on the component if necessary.
075:             * <li>Create/add any required sub-components to the component.
076:             * <li>Create/install event listeners on the component.
077:             * <li>Create/install a <code>PropertyChangeListener</code> on the component in order
078:             *     to detect and respond to component property changes appropriately.
079:             * <li>Install keyboard UI (mnemonics, traversal, etc.) on the component.
080:             * <li>Initialize any appropriate instance data.
081:             * </ol>
082:             * @param c the component where this UI delegate is being installed
083:             *
084:             * @see #uninstallUI
085:             * @see javax.swing.JComponent#setUI
086:             * @see javax.swing.JComponent#updateUI
087:             */
088:            @Override
089:            public void installUI(JComponent c) {
090:                assert c instanceof  JXStatusBar;
091:                statusBar = (JXStatusBar) c;
092:
093:                Border b = statusBar.getBorder();
094:                if (b == null || b instanceof  UIResource) {
095:                    statusBar.setBorder(new BorderUIResource(BorderFactory
096:                            .createEmptyBorder(4, 5, 4, 22)));
097:                }
098:
099:                LayoutManager m = statusBar.getLayout();
100:                if (m == null) {
101:                    statusBar.setLayout(new FlowLayout());
102:                }
103:                installDefaults();
104:            }
105:
106:            protected void installDefaults() {
107:                statusBar.setOpaque(false);
108:            }
109:
110:            /**
111:             * Reverses configuration which was done on the specified component during
112:             * <code>installUI</code>.  This method is invoked when this 
113:             * <code>UIComponent</code> instance is being removed as the UI delegate 
114:             * for the specified component.  This method should undo the
115:             * configuration performed in <code>installUI</code>, being careful to 
116:             * leave the <code>JComponent</code> instance in a clean state (no 
117:             * extraneous listeners, look-and-feel-specific property objects, etc.).
118:             * This should include the following:
119:             * <ol>
120:             * <li>Remove any UI-set borders from the component.
121:             * <li>Remove any UI-set layout managers on the component.
122:             * <li>Remove any UI-added sub-components from the component.
123:             * <li>Remove any UI-added event/property listeners from the component.
124:             * <li>Remove any UI-installed keyboard UI from the component.
125:             * <li>Nullify any allocated instance data objects to allow for GC.
126:             * </ol>
127:             * @param c the component from which this UI delegate is being removed;
128:             *          this argument is often ignored,
129:             *          but might be used if the UI object is stateless
130:             *          and shared by multiple components
131:             *
132:             * @see #installUI
133:             * @see javax.swing.JComponent#updateUI
134:             */
135:            @Override
136:            public void uninstallUI(JComponent c) {
137:                assert c instanceof  JXStatusBar;
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.