Source Code Cross Referenced for BasicOffice2003Theme.java in  » Swing-Library » jide-common » com » jidesoft » plaf » office2003 » 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 » jide common » com.jidesoft.plaf.office2003 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)BasicOffice2003Theme.java 3/17/2006
003:         *
004:         * Copyright 2002 - 2006 JIDE Software Inc. All rights reserved.
005:         */
006:
007:        package com.jidesoft.plaf.office2003;
008:
009:        import com.jidesoft.icons.IconsFactory;
010:        import com.jidesoft.plaf.LookAndFeelFactory;
011:        import com.jidesoft.utils.ColorUtils;
012:
013:        import javax.swing.*;
014:        import javax.swing.plaf.ColorUIResource;
015:        import java.awt.*;
016:
017:        /**
018:         * <tt>BasicOffice2003Theme</tt> is a special Office2003 theme that uses a base color to calculate
019:         * all other colors used by JIDE components. This is done regardless what current XP theme you are using.
020:         */
021:        public class BasicOffice2003Theme extends Office2003Theme {
022:            private Color _baseColor;
023:
024:            public BasicOffice2003Theme(String themeName) {
025:                super (themeName);
026:            }
027:
028:            /**
029:             * Sets the base color. The Office2003 theme will use this color as base color and calculate
030:             * all other colors that will be used by JIDE components.
031:             *
032:             * @param color                 the base color.
033:             * @param derivedSelectionColor if deriving selection colors from the base color. Selection color is used in
034:             *                              places like JideButton's background and DockableFrame's title pane background.
035:             * @param prefix                the prefix is for the expand/collapse icon on collapsible pane. Available prefixes are
036:             *                              "default", "blue", "homestead", "metallic", and "gray". You can decide which one to use depending
037:             *                              on what base color is. In most cases, "default" works just fine. But if your base color has more blue,
038:             *                              using "blue" will produce a better result. If green, you can use "homestead".
039:             */
040:            public void setBaseColor(Color color,
041:                    boolean derivedSelectionColor, String prefix) {
042:                _baseColor = color;
043:                float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(),
044:                        color.getBlue(), null);
045:                Color selectionColor = Color.getHSBColor(hsb[0],
046:                        (hsb[1] > 0.01) ? 0.45f : hsb[0], 0.90f);
047:
048:                Object uiDefaults[] = { "control",
049:                        ColorUtils.getDerivedColor(color, 0.9f), "controlLt",
050:                        ColorUtils.getDerivedColor(color, 0.95f), "controlDk",
051:                        ColorUtils.getDerivedColor(color, 0.8f),
052:                        "controlShadow",
053:                        ColorUtils.getDerivedColor(color, 0.4f),
054:
055:                        "TabbedPane.selectDk",
056:                        ColorUtils.getDerivedColor(selectionColor, 0.40f),
057:                        "TabbedPane.selectLt",
058:                        ColorUtils.getDerivedColor(selectionColor, 0.55f),
059:
060:                        "OptionPane.bannerLt",
061:                        ColorUtils.getDerivedColor(color, 0.5f),
062:                        "OptionPane.bannerDk",
063:                        ColorUtils.getDerivedColor(color, 0.3f),
064:                        "OptionPane.bannerForeground",
065:                        new ColorUIResource(255, 255, 255),
066:
067:                        "Separator.foreground",
068:                        ColorUtils.getDerivedColor(color, 0.4f),
069:                        "Separator.foregroundLt",
070:                        ColorUtils.getDerivedColor(color, 1.0f),
071:
072:                        "Gripper.foreground",
073:                        ColorUtils.getDerivedColor(color, 0.6f),
074:                        "Gripper.foregroundLt",
075:                        ColorUtils.getDerivedColor(color, 0.92f),
076:
077:                        "Chevron.backgroundLt",
078:                        ColorUtils.getDerivedColor(color, 0.85f),
079:                        "Chevron.backgroundDk",
080:                        ColorUtils.getDerivedColor(color, 0.75f),
081:
082:                        "Divider.backgroundLt",
083:                        ColorUtils.getDerivedColor(color, 0.9f),
084:                        "Divider.backgroundDk",
085:                        ColorUtils.getDerivedColor(color, 0.97f),
086:
087:                        "backgroundLt",
088:                        ColorUtils.getDerivedColor(color, 0.95f),
089:                        "backgroundDk",
090:                        ColorUtils.getDerivedColor(color, 0.9f),
091:
092:                        "CommandBar.titleBarBackground",
093:                        ColorUtils.getDerivedColor(color, 0.6f),
094:                        "MenuItem.background",
095:                        ColorUtils.getDerivedColor(color, 0.95f),
096:
097:                        "DockableFrameTitlePane.backgroundLt",
098:                        ColorUtils.getDerivedColor(color, 0.92f),
099:                        "DockableFrameTitlePane.backgroundDk",
100:                        ColorUtils.getDerivedColor(color, 0.85f),
101:                        "DockableFrameTitlePane.activeForeground",
102:                        new ColorUIResource(0, 0, 0),
103:                        "DockableFrameTitlePane.inactiveForeground",
104:                        new ColorUIResource(0, 0, 0),
105:                        "DockableFrame.backgroundLt",
106:                        ColorUtils.getDerivedColor(color, 0.92f),
107:                        "DockableFrame.backgroundDk",
108:                        ColorUtils.getDerivedColor(color, 0.89f),
109:
110:                        "selection.border",
111:                        ColorUtils.getDerivedColor(color, 0.5f) };
112:
113:                putDefaults(uiDefaults);
114:
115:                int products = LookAndFeelFactory.getProductsUsed();
116:                if ((products & LookAndFeelFactory.PRODUCT_COMPONENTS) != 0) {
117:                    final int SIZE = 20;
118:                    final int MASK_SIZE = 11;
119:                    ImageIcon collapsiblePaneImage = IconsFactory.getImageIcon(
120:                            Office2003WindowsUtils.class,
121:                            "icons/collapsible_pane_" + prefix + ".png"); // 20 x 20
122:                    ImageIcon collapsiblePaneMask = IconsFactory.getImageIcon(
123:                            Office2003WindowsUtils.class,
124:                            "icons/collapsible_pane_mask.png"); // 11 x 11
125:                    ImageIcon normalIcon = IconsFactory.getIcon(null,
126:                            collapsiblePaneImage, 0, 0, SIZE, SIZE);
127:                    ImageIcon emphasizedIcon = IconsFactory.getIcon(null,
128:                            collapsiblePaneImage, SIZE, 0, SIZE, SIZE);
129:                    ImageIcon upMark = IconsFactory.getIcon(null,
130:                            collapsiblePaneMask, 0, 0, MASK_SIZE, MASK_SIZE);
131:                    ImageIcon downMark = IconsFactory.getIcon(null,
132:                            collapsiblePaneMask, 0, MASK_SIZE, MASK_SIZE,
133:                            MASK_SIZE);
134:                    uiDefaults = new Object[] {
135:                            "CollapsiblePane.contentBackground",
136:                            ColorUtils.getDerivedColor(color, 0.98f),
137:                            "CollapsiblePanes.backgroundLt",
138:                            ColorUtils.getDerivedColor(color, 0.82f),
139:                            "CollapsiblePanes.backgroundDk",
140:                            ColorUtils.getDerivedColor(color, 0.78f),
141:                            "CollapsiblePaneTitlePane.backgroundLt",
142:                            ColorUtils.getDerivedColor(color, 0.98f),
143:                            "CollapsiblePaneTitlePane.backgroundDk",
144:                            ColorUtils.getDerivedColor(color, 0.93f),
145:                            "CollapsiblePaneTitlePane.foreground",
146:                            new ColorUIResource(63, 61, 61),
147:                            "CollapsiblePaneTitlePane.foreground.focus",
148:                            new ColorUIResource(126, 124, 124),
149:                            "CollapsiblePaneTitlePane.backgroundLt.emphasized",
150:                            ColorUtils.getDerivedColor(color, 0.7f),
151:                            "CollapsiblePaneTitlePane.backgroundDk.emphasized",
152:                            ColorUtils.getDerivedColor(color, 0.72f),
153:                            "CollapsiblePaneTitlePane.foreground.emphasized",
154:                            new ColorUIResource(255, 255, 255),
155:                            "CollapsiblePaneTitlePane.foreground.focus.emphasized",
156:                            new ColorUIResource(230, 230, 230),
157:
158:                            "CollapsiblePane.downIcon",
159:                            IconsFactory.getOverlayIcon(null, normalIcon,
160:                                    downMark, SwingConstants.CENTER),
161:                            "CollapsiblePane.upIcon",
162:                            IconsFactory.getOverlayIcon(null, normalIcon,
163:                                    upMark, SwingConstants.CENTER),
164:                            "CollapsiblePane.downIcon.emphasized",
165:                            IconsFactory.getOverlayIcon(null, emphasizedIcon,
166:                                    downMark, SwingConstants.CENTER),
167:                            "CollapsiblePane.upIcon.emphasized",
168:                            IconsFactory.getOverlayIcon(null, emphasizedIcon,
169:                                    upMark, SwingConstants.CENTER),
170:                            "CollapsiblePane.upMask", upMark,
171:                            "CollapsiblePane.downMask", downMark,
172:                            "CollapsiblePane.titleButtonBackground",
173:                            normalIcon,
174:                            "CollapsiblePane.titleButtonBackground.emphasized",
175:                            emphasizedIcon, };
176:                    putDefaults(uiDefaults);
177:                }
178:
179:                if (derivedSelectionColor) {
180:                    Object[] uiDefaultsSelection = new Object[] {
181:                            "selection.Rollover",
182:                            selectionColor,
183:                            "selection.RolloverLt",
184:                            ColorUtils.getDerivedColor(selectionColor, 0.55f),
185:                            "selection.RolloverDk",
186:                            ColorUtils.getDerivedColor(selectionColor, 0.45f),
187:
188:                            "selection.Selected",
189:                            ColorUtils.getDerivedColor(selectionColor, 0.45f),
190:                            "selection.SelectedLt",
191:                            ColorUtils.getDerivedColor(selectionColor, 0.55f),
192:                            "selection.SelectedDk",
193:                            ColorUtils.getDerivedColor(selectionColor, 0.50f),
194:
195:                            "selection.Pressed",
196:                            ColorUtils.getDerivedColor(selectionColor, 0.4f), // focused and selected;
197:                            "selection.PressedLt",
198:                            ColorUtils.getDerivedColor(selectionColor, 0.45f),
199:                            "selection.PressedDk",
200:                            ColorUtils.getDerivedColor(selectionColor, 0.35f) };
201:                    putDefaults(uiDefaultsSelection);
202:                }
203:
204:            }
205:
206:            /**
207:             * Gets the base color for this theme. It is set using
208:             * {@link #setBaseColor(java.awt.Color,boolean,String)} method.
209:             *
210:             * @return the base color.
211:             */
212:            public Color getBaseColor() {
213:                return _baseColor;
214:            }
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.