Source Code Cross Referenced for SubstanceBlendBiTheme.java in  » Swing-Library » substance-look-feel » org » jvnet » substance » theme » 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 » substance look feel » org.jvnet.substance.theme 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without 
005:         * modification, are permitted provided that the following conditions are met:
006:         * 
007:         *  o Redistributions of source code must retain the above copyright notice, 
008:         *    this list of conditions and the following disclaimer. 
009:         *     
010:         *  o Redistributions in binary form must reproduce the above copyright notice, 
011:         *    this list of conditions and the following disclaimer in the documentation 
012:         *    and/or other materials provided with the distribution. 
013:         *     
014:         *  o Neither the name of Substance Kirill Grouchnikov nor the names of 
015:         *    its contributors may be used to endorse or promote products derived 
016:         *    from this software without specific prior written permission. 
017:         *     
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
020:         * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
021:         * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
022:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
023:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
025:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
027:         * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
028:         * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
029:         */
030:        package org.jvnet.substance.theme;
031:
032:        import org.jvnet.substance.color.BlendBiColorScheme;
033:
034:        /**
035:         * Blend theme. Blend theme is based on two original themes and the blend
036:         * factor, blending the colors from both themes for the painting. Here is how
037:         * you can create and set a blend theme:<br>
038:         * <br>
039:         * 
040:         * <code>
041:         * SubstanceTheme blend = new SubstanceBlendBiTheme(<br>
042:         * &nbsp;&nbsp;SubstanceAquaTheme(), SubstanceBottleGreenTheme(), 0.4);<br>
043:         * SubstanceLookAndFeel.setCurrentTheme(blend);<br>
044:         * for (Frame frame : Frame.getFrames()) {<br>
045:         * &nbsp;&nbsp;SwingUtilities.updateComponentTreeUI(frame);<br>
046:         * }
047:         * </code> <br>
048:         * This class is part of officially supported API.
049:         * 
050:         * @author Kirill Grouchnikov
051:         */
052:        public class SubstanceBlendBiTheme extends SubstanceTheme {
053:            /**
054:             * The first original theme.
055:             */
056:            private SubstanceTheme originalFirstTheme;
057:
058:            /**
059:             * The second original theme.
060:             */
061:            private SubstanceTheme originalSecondTheme;
062:
063:            /**
064:             * Likeness to the {@link #originalFirstTheme}. Values close to 0.0 will
065:             * create theme that closely matches the {@link #originalSecondTheme}.
066:             * Values close to 1.0 will create theme that closely matches the
067:             * {@link #originalFirstTheme}.
068:             */
069:            private double firstThemeLikeness;
070:
071:            /**
072:             * Creates a new blended theme.
073:             * 
074:             * @param originalFirstTheme
075:             *            The first original theme.
076:             * @param originalSecondTheme
077:             *            The second original theme.
078:             * @param firstThemeLikeness
079:             *            Likeness to the first theme. Values close to 0.0 will create
080:             *            theme that closely matches the second original theme. Values
081:             *            close to 1.0 will create theme that closely matches the first
082:             *            original scheme.
083:             */
084:            public SubstanceBlendBiTheme(SubstanceTheme originalFirstTheme,
085:                    SubstanceTheme originalSecondTheme,
086:                    double firstThemeLikeness) {
087:                super (new BlendBiColorScheme(originalFirstTheme
088:                        .getColorScheme(),
089:                        originalSecondTheme.getColorScheme(),
090:                        firstThemeLikeness), "Blended "
091:                        + originalFirstTheme.getDisplayName() + " & "
092:                        + originalSecondTheme.getDisplayName() + " "
093:                        + firstThemeLikeness,
094:                        (firstThemeLikeness >= 0.5) ? originalFirstTheme
095:                                .getKind() : originalSecondTheme.getKind());
096:                this .originalFirstTheme = originalFirstTheme;
097:                this .originalSecondTheme = originalSecondTheme;
098:                this .firstThemeLikeness = firstThemeLikeness;
099:            }
100:
101:            /*
102:             * (non-Javadoc)
103:             * 
104:             * @see org.jvnet.substance.theme.SubstanceTheme#tint(double)
105:             */
106:            @Override
107:            public SubstanceTheme tint(double tintFactor) {
108:                return new SubstanceBlendBiTheme(this .originalFirstTheme
109:                        .tint(tintFactor), this .originalSecondTheme
110:                        .tint(tintFactor), this .firstThemeLikeness);
111:            }
112:
113:            /*
114:             * (non-Javadoc)
115:             * 
116:             * @see org.jvnet.substance.theme.SubstanceTheme#tone(double)
117:             */
118:            @Override
119:            public SubstanceTheme tone(double toneFactor) {
120:                return new SubstanceBlendBiTheme(this .originalFirstTheme
121:                        .tone(toneFactor), this .originalSecondTheme
122:                        .tone(toneFactor), this .firstThemeLikeness);
123:            }
124:
125:            /*
126:             * (non-Javadoc)
127:             * 
128:             * @see org.jvnet.substance.theme.SubstanceTheme#shade(double)
129:             */
130:            @Override
131:            public SubstanceTheme shade(double shadeFactor) {
132:                return new SubstanceBlendBiTheme(this .originalFirstTheme
133:                        .shade(shadeFactor), this .originalSecondTheme
134:                        .shade(shadeFactor), this .firstThemeLikeness);
135:            }
136:
137:            /*
138:             * (non-Javadoc)
139:             * 
140:             * @see org.jvnet.substance.theme.SubstanceTheme#saturate(double, boolean)
141:             */
142:            @Override
143:            public SubstanceTheme saturate(double saturateFactor,
144:                    boolean toSaturateEverything) {
145:                return new SubstanceBlendBiTheme(this .originalFirstTheme
146:                        .saturate(saturateFactor, toSaturateEverything),
147:                        this .originalSecondTheme.saturate(saturateFactor,
148:                                toSaturateEverything), this .firstThemeLikeness);
149:            }
150:
151:            /*
152:             * (non-Javadoc)
153:             * 
154:             * @see org.jvnet.substance.theme.SubstanceTheme#invert()
155:             */
156:            @Override
157:            public SubstanceTheme invert() {
158:                return new SubstanceBlendBiTheme(this .originalFirstTheme
159:                        .invert(), this .originalSecondTheme.invert(),
160:                        this .firstThemeLikeness);
161:            }
162:
163:            /*
164:             * (non-Javadoc)
165:             * 
166:             * @see org.jvnet.substance.theme.SubstanceTheme#negate()
167:             */
168:            @Override
169:            public SubstanceTheme negate() {
170:                return new SubstanceBlendBiTheme(this .originalFirstTheme
171:                        .negate(), this .originalSecondTheme.negate(),
172:                        this .firstThemeLikeness);
173:            }
174:
175:            /*
176:             * (non-Javadoc)
177:             * 
178:             * @see org.jvnet.substance.theme.SubstanceTheme#hueShift(double)
179:             */
180:            @Override
181:            public SubstanceTheme hueShift(double hueShiftFactor) {
182:                return new SubstanceBlendBiTheme(this .originalFirstTheme
183:                        .hueShift(hueShiftFactor), this .originalSecondTheme
184:                        .hueShift(hueShiftFactor), this .firstThemeLikeness);
185:            }
186:
187:            /**
188:             * Returns the first original theme.
189:             * 
190:             * @return The first original theme.
191:             */
192:            public SubstanceTheme getOriginalFirstTheme() {
193:                return this .originalFirstTheme;
194:            }
195:
196:            /**
197:             * Returns the second original theme.
198:             * 
199:             * @return The second original theme.
200:             */
201:            public SubstanceTheme getOriginalSecondTheme() {
202:                return this.originalSecondTheme;
203:            }
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.