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


001:        /*
002:         * ShadesOfGrayTheme.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;
023:
024:        import java.awt.Color;
025:        import java.awt.Font;
026:        import java.awt.Insets;
027:        import java.util.Arrays;
028:        import javax.swing.UIDefaults;
029:        import javax.swing.UIManager;
030:        import javax.swing.plaf.ColorUIResource;
031:        import javax.swing.plaf.FontUIResource;
032:        import javax.swing.plaf.metal.DefaultMetalTheme;
033:
034:        /* ----------------------------------------------------------
035:         * CVS NOTE: Changes to the CVS repository prior to the 
036:         *           release of version 3.0.0beta1 has meant a 
037:         *           resetting of CVS revision numbers.
038:         * ----------------------------------------------------------
039:         */
040:
041:        /**
042:         * Metal Look and feel theme extension using SmoothGradient.
043:         *
044:         * @author   Takis Diakoumis
045:         * @version  $Revision: 1.5 $
046:         * @date     $Date: 2006/07/08 15:56:59 $
047:         */
048:        public class ShadesOfGrayTheme extends DefaultMetalTheme {
049:
050:            // ---------------------------------
051:            // --------- System Fonts ----------
052:            // ---------------------------------
053:            private FontUIResource menuFont;
054:            private FontUIResource controlFont;
055:            private FontUIResource systemFont;
056:            private FontUIResource userFont;
057:            private FontUIResource smallFont;
058:
059:            // --------------------------------------------
060:            // ------ Primary and Secondary Colours -------
061:            // --------------------------------------------
062:            // ********************************************
063:            // --------------------------------------------
064:            // ------------ Java Look and Feel ------------
065:            // --------------------------------------------
066:            // -------- primary 1:     102,102,153 --------
067:            // -------- primary 2:     153,153,204 --------
068:            // -------- primary 3:     204,204,255 --------
069:            // -------- secondary 1:   102,102,102 --------
070:            // -------- secondary 2:   153,153,153 --------
071:            // -------- secondary 3:   204,204,204 --------
072:            // --------------------------------------------
073:            // ********************************************
074:            // --------------------------------------------
075:            // ------------ Execute Query Theme -----------
076:            // --------------------------------------------
077:
078:            // --- active internal frame borders ---
079:            private final ColorUIResource primary1 = new ColorUIResource(102,
080:                    102, 153);
081:
082:            // --- scroll bars, highlights, menu selection etc ---
083:            private final ColorUIResource primary2 = new ColorUIResource(145,
084:                    145, 207);
085:
086:            // --- active internal frame headers ---
087:            private final ColorUIResource primary3 = new ColorUIResource(169,
088:                    169, 242);
089:
090:            // --- dark border for 3D for eg buttons ---
091:            private final ColorUIResource secondary1 = new ColorUIResource(102,
092:                    102, 102);
093:
094:            // --- inactive internal frame borders, dimmed button borders ---
095:            private final ColorUIResource secondary2 = new ColorUIResource(153,
096:                    153, 153);
097:
098:            // --- panel/frame, normal background ---
099:            private final ColorUIResource secondary3 = new ColorUIResource(240,
100:                    240, 240);
101:
102:            public ShadesOfGrayTheme() {
103:                // ------------------------------
104:                // add some further l&f settings
105:                // ------------------------------
106:                // black text for labels
107:                UIManager.put("Label.foreground", new ColorUIResource(0, 0, 0));
108:                // black text for title border
109:                UIManager.put("TitledBorder.titleColor", new ColorUIResource(0,
110:                        0, 0));
111:                // toggle button selected colour to primary3
112:                UIManager.put("ToggleButton.select", primary3);
113:
114:            }
115:
116:            /**
117:             * Add this theme's custom entries to the defaults table.
118:             *
119:             * @param table the defaults table, non-null
120:             * @throws NullPointerException if the parameter is null
121:             */
122:            public void addCustomEntriesToTable(UIDefaults table) {
123:                super .addCustomEntriesToTable(table);
124:
125:                Color dadada = new ColorUIResource(0xDADADA);
126:                Color cccccc = new ColorUIResource(0xCCCCCC);
127:
128:                Object[] defaults = new Object[] {
129:
130:                        "TabbedPane.borderHightlightColor",
131:                        secondary1,
132:                        "TabbedPane.contentAreaColor",
133:                        secondary3,
134:                        "TabbedPane.contentBorderInsets",
135:                        new Insets(2, 2, 3, 3),
136:                        "TabbedPane.selected",
137:                        secondary3,
138:                        "TabbedPane.tabAreaBackground",
139:                        secondary3,
140:                        "TabbedPane.tabAreaInsets",
141:                        new Insets(4, 2, 0, 6),
142:                        "TabbedPane.unselectedBackground",
143:                        cccccc,
144:
145:                        "Menu.opaque",
146:                        Boolean.FALSE,
147:                        "MenuBar.gradient",
148:                        Arrays.asList(new Object[] { new Float(1f),
149:                                new Float(0f), getWhite(), dadada,
150:                                new ColorUIResource(dadada) }),
151:                        "MenuBar.borderColor", cccccc, "MenuBarUI",
152:                        "javax.swing.plaf.metal.MetalMenuBarUI"
153:
154:                };
155:                table.putDefaults(defaults);
156:            }
157:
158:            public String getName() {
159:                return "Shades of Gray";
160:            }
161:
162:            private static final int DEFAULT_FONT_SIZE = 11;
163:
164:            public int getDefaultFontSize() {
165:                return DEFAULT_FONT_SIZE;
166:            }
167:
168:            public FontUIResource getControlTextFont() {
169:
170:                if (controlFont == null) {
171:
172:                    try {
173:                        controlFont = new FontUIResource(Font.getFont(
174:                                "swing.plaf.metal.controlFont", new Font(
175:                                        "Dialog", Font.PLAIN,
176:                                        getDefaultFontSize())));
177:                    } catch (Exception e) {
178:                        controlFont = new FontUIResource("Dialog", Font.BOLD,
179:                                getDefaultFontSize());
180:                    }
181:
182:                }
183:
184:                return controlFont;
185:
186:            }
187:
188:            public FontUIResource getSystemTextFont() {
189:
190:                if (systemFont == null) {
191:
192:                    try {
193:                        systemFont = new FontUIResource(Font.getFont(
194:                                "swing.plaf.metal.systemFont", new Font(
195:                                        "Dialog", Font.PLAIN,
196:                                        getDefaultFontSize())));
197:                    } catch (Exception e) {
198:                        systemFont = new FontUIResource("Dialog", Font.PLAIN,
199:                                getDefaultFontSize());
200:                    }
201:
202:                }
203:
204:                return systemFont;
205:
206:            }
207:
208:            public FontUIResource getUserTextFont() {
209:
210:                if (userFont == null) {
211:
212:                    try {
213:                        userFont = new FontUIResource(Font.getFont(
214:                                "swing.plaf.metal.userFont", new Font("Dialog",
215:                                        Font.PLAIN, getDefaultFontSize())));
216:                    } catch (Exception e) {
217:                        userFont = new FontUIResource("Dialog", Font.PLAIN,
218:                                getDefaultFontSize());
219:                    }
220:
221:                }
222:
223:                return userFont;
224:            }
225:
226:            public FontUIResource getMenuTextFont() {
227:
228:                if (menuFont == null) {
229:
230:                    try {
231:                        menuFont = new FontUIResource(Font.getFont(
232:                                "swing.plaf.metal.menuFont", new Font("Dialog",
233:                                        Font.PLAIN, getDefaultFontSize())));
234:                    } catch (Exception e) {
235:                        menuFont = new FontUIResource("Dialog", Font.PLAIN,
236:                                getDefaultFontSize());
237:                    }
238:
239:                }
240:
241:                return menuFont;
242:
243:            }
244:
245:            public FontUIResource getWindowTitleFont() {
246:
247:                if (controlFont == null) {
248:
249:                    try {
250:                        controlFont = new FontUIResource(Font.getFont(
251:                                "swing.plaf.metal.controlFont", new Font(
252:                                        "Dialog", Font.PLAIN,
253:                                        getDefaultFontSize())));
254:                    } catch (Exception e) {
255:                        controlFont = new FontUIResource("Dialog", Font.BOLD,
256:                                getDefaultFontSize());
257:                    }
258:
259:                }
260:
261:                return controlFont;
262:
263:            }
264:
265:            public FontUIResource getSubTextFont() {
266:
267:                if (smallFont == null) {
268:
269:                    try {
270:                        smallFont = new FontUIResource(Font.getFont(
271:                                "swing.plaf.metal.smallFont", new Font(
272:                                        "Dialog", Font.PLAIN, 10)));
273:                    } catch (Exception e) {
274:                        smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
275:                    }
276:
277:                }
278:
279:                return smallFont;
280:
281:            }
282:
283:            protected ColorUIResource getPrimary1() {
284:                return primary1;
285:            }
286:
287:            protected ColorUIResource getPrimary2() {
288:                return primary2;
289:            }
290:
291:            protected ColorUIResource getPrimary3() {
292:                return primary3;
293:            }
294:
295:            protected ColorUIResource getSecondary1() {
296:                return secondary1;
297:            }
298:
299:            protected ColorUIResource getSecondary2() {
300:                return secondary2;
301:            }
302:
303:            protected ColorUIResource getSecondary3() {
304:                return secondary3;
305:            }
306:
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.