Source Code Cross Referenced for SmoothGradientInternalFrameUI.java in  » Database-Client » executequery » org » underworldlabs » swing » plaf » smoothgradient » 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 » Database Client » executequery » org.underworldlabs.swing.plaf.smoothgradient 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SmoothGradientInternalFrameUI.java
003:         *
004:         * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
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
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         */
021:
022:        package org.underworldlabs.swing.plaf.smoothgradient;
023:
024:        import java.awt.Color;
025:        import java.awt.Container;
026:        import java.beans.PropertyChangeEvent;
027:        import java.beans.PropertyChangeListener;
028:
029:        import javax.swing.JComponent;
030:        import javax.swing.JInternalFrame;
031:        import javax.swing.LookAndFeel;
032:        import javax.swing.UIManager;
033:        import javax.swing.border.Border;
034:        import javax.swing.border.EmptyBorder;
035:        import javax.swing.plaf.ComponentUI;
036:        import javax.swing.plaf.UIResource;
037:        import javax.swing.plaf.basic.BasicInternalFrameUI;
038:
039:        /* ----------------------------------------------------------
040:         * CVS NOTE: Changes to the CVS repository prior to the 
041:         *           release of version 3.0.0beta1 has meant a 
042:         *           resetting of CVS revision numbers.
043:         * ----------------------------------------------------------
044:         */
045:
046:        /**
047:         *
048:         * @author   Takis Diakoumis
049:         * @version  $Revision: 1.4 $
050:         * @date     $Date: 2006/05/14 06:56:07 $
051:         */
052:        public class SmoothGradientInternalFrameUI extends BasicInternalFrameUI {
053:
054:            private static final String FRAME_TYPE = "JInternalFrame.frameType";
055:            public static final String IS_PALETTE = "JInternalFrame.isPalette";
056:            private static final String PALETTE_FRAME = "palette";
057:            private static final String OPTION_DIALOG = "optionDialog";
058:            private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0,
059:                    0);
060:
061:            private SmoothGradientInternalFrameTitlePane titlePane;
062:            private PropertyChangeListener paletteListener;
063:            private PropertyChangeListener contentPaneListener;
064:
065:            public SmoothGradientInternalFrameUI(JInternalFrame b) {
066:                super (b);
067:            }
068:
069:            public static ComponentUI createUI(JComponent c) {
070:                return new SmoothGradientInternalFrameUI((JInternalFrame) c);
071:            }
072:
073:            public void installUI(JComponent c) {
074:                frame = (JInternalFrame) c;
075:
076:                paletteListener = new PaletteListener(this );
077:                contentPaneListener = new ContentPaneListener(this );
078:                c.addPropertyChangeListener(paletteListener);
079:                c.addPropertyChangeListener(contentPaneListener);
080:
081:                super .installUI(c);
082:
083:                Object paletteProp = c.getClientProperty(IS_PALETTE);
084:                if (paletteProp != null) {
085:                    setPalette(((Boolean) paletteProp).booleanValue());
086:                }
087:
088:                Container content = frame.getContentPane();
089:                stripContentBorder(content);
090:            }
091:
092:            public void uninstallUI(JComponent c) {
093:                frame = (JInternalFrame) c;
094:
095:                c.removePropertyChangeListener(paletteListener);
096:                c.removePropertyChangeListener(contentPaneListener);
097:
098:                Container cont = ((JInternalFrame) (c)).getContentPane();
099:                if (cont instanceof  JComponent) {
100:                    JComponent content = (JComponent) cont;
101:                    if (content.getBorder() == EMPTY_BORDER) {
102:                        content.setBorder(null);
103:                    }
104:                }
105:                super .uninstallUI(c);
106:            }
107:
108:            protected void installDefaults() {
109:                super .installDefaults();
110:
111:                /* Enable the content pane to inherit background color 
112:                 * from its parent by setting its background color to null. 
113:                 * Fixes bug#4268949, which has been fixed in 1.4, too. */
114:                JComponent contentPane = (JComponent) frame.getContentPane();
115:                if (contentPane != null) {
116:                    Color bg = contentPane.getBackground();
117:                    if (bg instanceof  UIResource)
118:                        contentPane.setBackground(null);
119:                }
120:                frame.setBackground(UIManager.getLookAndFeelDefaults()
121:                        .getColor("control"));
122:            }
123:
124:            protected void installKeyboardActions() {
125:            }
126:
127:            protected void uninstallKeyboardActions() {
128:            }
129:
130:            private void stripContentBorder(Object c) {
131:                if (c instanceof  JComponent) {
132:                    JComponent contentComp = (JComponent) c;
133:                    Border contentBorder = contentComp.getBorder();
134:                    if (contentBorder == null
135:                            || contentBorder instanceof  UIResource) {
136:                        contentComp.setBorder(EMPTY_BORDER);
137:                    }
138:                }
139:            }
140:
141:            protected JComponent createNorthPane(JInternalFrame w) {
142:                titlePane = new SmoothGradientInternalFrameTitlePane(w);
143:                return titlePane;
144:            }
145:
146:            public void setPalette(boolean isPalette) {
147:                String key = isPalette ? "InternalFrame.paletteBorder"
148:                        : "InternalFrame.border";
149:                LookAndFeel.installBorder(frame, key);
150:                titlePane.setPalette(isPalette);
151:            }
152:
153:            private void setFrameType(String frameType) {
154:                String key;
155:                boolean hasPalette = frameType.equals(PALETTE_FRAME);
156:                if (frameType.equals(OPTION_DIALOG)) {
157:                    key = "InternalFrame.optionDialogBorder";
158:                } else if (hasPalette) {
159:                    key = "InternalFrame.paletteBorder";
160:                } else {
161:                    key = "InternalFrame.border";
162:                }
163:                LookAndFeel.installBorder(frame, key);
164:                titlePane.setPalette(hasPalette);
165:            }
166:
167:            private static class PaletteListener implements 
168:                    PropertyChangeListener {
169:
170:                private final SmoothGradientInternalFrameUI ui;
171:
172:                private PaletteListener(SmoothGradientInternalFrameUI ui) {
173:                    this .ui = ui;
174:                }
175:
176:                public void propertyChange(PropertyChangeEvent e) {
177:                    String name = e.getPropertyName();
178:                    Object value = e.getNewValue();
179:                    if (name.equals(FRAME_TYPE)) {
180:                        if (value instanceof  String) {
181:                            ui.setFrameType((String) value);
182:                        }
183:                    } else if (name.equals(IS_PALETTE)) {
184:                        ui.setPalette(Boolean.TRUE.equals(value));
185:                    }
186:                }
187:            }
188:
189:            private static class ContentPaneListener implements 
190:                    PropertyChangeListener {
191:
192:                private final SmoothGradientInternalFrameUI ui;
193:
194:                private ContentPaneListener(SmoothGradientInternalFrameUI ui) {
195:                    this .ui = ui;
196:                }
197:
198:                public void propertyChange(PropertyChangeEvent e) {
199:                    String name = e.getPropertyName();
200:                    if (name.equals(JInternalFrame.CONTENT_PANE_PROPERTY)) {
201:                        ui.stripContentBorder(e.getNewValue());
202:                    }
203:                }
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.