Source Code Cross Referenced for SubstanceTheme.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) 


0001:        /*
0002:         * Copyright (c) 2005-2008 Substance Kirill Grouchnikov. All Rights Reserved.
0003:         *
0004:         * Redistribution and use in source and binary forms, with or without
0005:         * modification, are permitted provided that the following conditions are met:
0006:         *
0007:         *  o Redistributions of source code must retain the above copyright notice,
0008:         *    this list of conditions and the following disclaimer.
0009:         *
0010:         *  o Redistributions in binary form must reproduce the above copyright notice,
0011:         *    this list of conditions and the following disclaimer in the documentation
0012:         *    and/or other materials provided with the distribution.
0013:         *
0014:         *  o Neither the name of Substance Kirill Grouchnikov nor the names of
0015:         *    its contributors may be used to endorse or promote products derived
0016:         *    from this software without specific prior written permission.
0017:         *
0018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0019:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
0020:         * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0021:         * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
0022:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0023:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0025:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0026:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
0027:         * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
0028:         * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0029:         */
0030:        package org.jvnet.substance.theme;
0031:
0032:        import java.awt.*;
0033:        import java.awt.event.KeyEvent;
0034:
0035:        import javax.swing.*;
0036:        import javax.swing.border.EmptyBorder;
0037:        import javax.swing.border.LineBorder;
0038:        import javax.swing.plaf.*;
0039:        import javax.swing.plaf.basic.BasicBorders;
0040:        import javax.swing.plaf.basic.BasicBorders.MarginBorder;
0041:        import javax.swing.table.JTableHeader;
0042:        import javax.swing.text.DefaultEditorKit;
0043:
0044:        import org.jvnet.lafwidget.animation.FadeKind;
0045:        import org.jvnet.substance.*;
0046:        import org.jvnet.substance.color.*;
0047:        import org.jvnet.substance.painter.StandardGradientPainter;
0048:        import org.jvnet.substance.painter.SubstanceGradientPainter;
0049:        import org.jvnet.substance.painter.decoration.DecorationAreaType;
0050:        import org.jvnet.substance.scroll.SubstanceScrollPaneBorder;
0051:        import org.jvnet.substance.utils.*;
0052:        import org.jvnet.substance.utils.icon.*;
0053:
0054:        /**
0055:         * Theme for <code>Substance</code> look and feel. This class is part of
0056:         * officially supported API.
0057:         * 
0058:         * @author Kirill Grouchnikov
0059:         */
0060:        public class SubstanceTheme implements  SubstanceTrait {
0061:            /**
0062:             * Color scheme for <code>this</code> theme.
0063:             */
0064:            private ColorScheme colorScheme;
0065:
0066:            /**
0067:             * Theme kind for <code>this</code> theme.
0068:             */
0069:            private ThemeKind kind;
0070:
0071:            /**
0072:             * Display name for <code>this</code> theme.
0073:             */
0074:            private String displayName;
0075:
0076:            /**
0077:             * Theme kind enumeration.
0078:             * 
0079:             * @author Kirill Grouchnikov.
0080:             */
0081:            public enum ThemeKind {
0082:                /**
0083:                 * Bright themes.
0084:                 */
0085:                BRIGHT,
0086:
0087:                /**
0088:                 * Cold themes.
0089:                 */
0090:                COLD,
0091:
0092:                /**
0093:                 * Dark themes.
0094:                 */
0095:                DARK,
0096:
0097:                /**
0098:                 * Inverted themes.
0099:                 */
0100:                INVERTED,
0101:
0102:                /**
0103:                 * Mixed themes.
0104:                 */
0105:                MIXED,
0106:
0107:                /**
0108:                 * Negated themes.
0109:                 */
0110:                NEGATED
0111:            }
0112:
0113:            // /**
0114:            // * Contains all themes.
0115:            // */
0116:            // private static Map<String, SubstanceTheme> allThemes = new
0117:            // HashMap<String, SubstanceTheme>();
0118:
0119:            /**
0120:             * Used as reference to the default color scheme. This field is <b>for
0121:             * internal use only</b>.
0122:             */
0123:            public static ColorScheme AQUA = new AquaColorScheme();
0124:
0125:            /**
0126:             * Used as reference to the green color scheme. This field is <b>for
0127:             * internal use only</b>.
0128:             */
0129:            public static ColorScheme GREEN = new BottleGreenColorScheme();
0130:
0131:            /**
0132:             * Used as reference in attention-drawing animations. This field is <b>for
0133:             * internal use only</b>.
0134:             */
0135:            public static ColorScheme YELLOW = new SunGlareColorScheme();
0136:
0137:            /**
0138:             * Used as reference in attention-drawing animations. This field is <b>for
0139:             * internal use only</b>.
0140:             */
0141:            public static ColorScheme ORANGE = new SunfireRedColorScheme();
0142:
0143:            /**
0144:             * Used as reference to default scheme of non-dark themes. This field is
0145:             * <b>for internal use only</b>.
0146:             */
0147:            private static ColorScheme METALLIC_SCHEME = new MetallicColorScheme();
0148:
0149:            /**
0150:             * Used as reference to default scheme of inverted themes. This field is
0151:             * <b>for internal use only</b>.
0152:             */
0153:            private static ColorScheme INVERTED_METALLIC_SCHEME = new InvertedColorScheme(
0154:                    METALLIC_SCHEME);
0155:
0156:            /**
0157:             * Used as reference to default scheme of negated themes. This field is
0158:             * <b>for internal use only</b>.
0159:             */
0160:            private static ColorScheme NEGATED_METALLIC_SCHEME = new NegatedColorScheme(
0161:                    METALLIC_SCHEME);
0162:
0163:            /**
0164:             * Used as reference to default scheme of dark themes. This field is <b>for
0165:             * internal use only</b>.
0166:             */
0167:            private static ColorScheme DARK_METALLIC_SCHEME = new DarkMetallicColorScheme();
0168:
0169:            /**
0170:             * Used as reference to disabled scheme of dark themes. This field is <b>for
0171:             * internal use only</b>.
0172:             */
0173:            private static ColorScheme DARK_GRAY_SCHEME = new DarkGrayColorScheme();
0174:
0175:            /**
0176:             * Used as reference to disabled scheme of non-dark themes. This field is
0177:             * <b>for internal use only</b>.
0178:             */
0179:            private static ColorScheme LIGHT_GRAY_SCHEME = new LightGrayColorScheme();
0180:
0181:            /**
0182:             * Used as reference to disabled scheme of inverted themes. This field is
0183:             * <b>for internal use only</b>.
0184:             */
0185:            private static ColorScheme INVERTED_LIGHT_GRAY_SCHEME = new InvertedColorScheme(
0186:                    LIGHT_GRAY_SCHEME);
0187:
0188:            /**
0189:             * Used as reference to disabled scheme of negated themes. This field is
0190:             * <b>for internal use only</b>.
0191:             */
0192:            private static ColorScheme NEGATED_LIGHT_GRAY_SCHEME = new NegatedColorScheme(
0193:                    LIGHT_GRAY_SCHEME);
0194:
0195:            /**
0196:             * Used as reference to default theme of non-dark themes. This field is
0197:             * <b>for internal use only</b>.
0198:             */
0199:            private static SubstanceTheme METALLIC = new SubstanceTheme(
0200:                    METALLIC_SCHEME, "Metallic", ThemeKind.COLD);
0201:
0202:            /**
0203:             * Used as reference to default theme of inverted themes. This field is
0204:             * <b>for internal use only</b>.
0205:             */
0206:            private static SubstanceTheme INVERTED_METALLIC = new SubstanceTheme(
0207:                    INVERTED_METALLIC_SCHEME, "Inverted Metallic",
0208:                    ThemeKind.INVERTED);
0209:
0210:            /**
0211:             * Used as reference to default theme of negated themes. This field is
0212:             * <b>for internal use only</b>.
0213:             */
0214:            private static SubstanceTheme NEGATED_METALLIC = new SubstanceTheme(
0215:                    NEGATED_METALLIC_SCHEME, "Negated Metallic",
0216:                    ThemeKind.NEGATED);
0217:
0218:            /**
0219:             * Used as reference to default theme of dark themes. This field is <b>for
0220:             * internal use only</b>.
0221:             */
0222:            private static SubstanceTheme DARK_METALLIC = new SubstanceTheme(
0223:                    DARK_METALLIC_SCHEME, "Dark Metallic", ThemeKind.DARK);
0224:
0225:            /**
0226:             * Used as reference to disabled theme of non-dark themes. This field is
0227:             * <b>for internal use only</b>.
0228:             */
0229:            private static SubstanceTheme LIGHT_GRAY = new SubstanceTheme(
0230:                    LIGHT_GRAY_SCHEME, "Light Gray", ThemeKind.COLD);
0231:
0232:            /**
0233:             * Used as reference to disabled theme of dark themes. This field is <b>for
0234:             * internal use only</b>.
0235:             */
0236:            private static SubstanceTheme DARK_GRAY = LIGHT_GRAY.negate();// new
0237:
0238:            // SubstanceTheme(
0239:
0240:            // DARK_GRAY_SCHEME, "Dark Gray", ThemeKind.DARK);
0241:
0242:            /**
0243:             * Used as reference to disabled theme of inverted themes. This field is
0244:             * <b>for internal use only</b>.
0245:             */
0246:            private static SubstanceTheme INVERTED_LIGHT_GRAY = new SubstanceTheme(
0247:                    INVERTED_LIGHT_GRAY_SCHEME, "Inverted Light Gray",
0248:                    ThemeKind.INVERTED);
0249:
0250:            /**
0251:             * Used as reference to disabled theme of negated themes. This field is
0252:             * <b>for internal use only</b>.
0253:             */
0254:            private static SubstanceTheme NEGATED_LIGHT_GRAY = new SubstanceTheme(
0255:                    NEGATED_LIGHT_GRAY_SCHEME, "Negated Light Gray",
0256:                    ThemeKind.NEGATED);
0257:
0258:            /**
0259:             * Theme for pressed states.
0260:             */
0261:            private SubstanceTheme pressedTheme;
0262:
0263:            private SubstanceTheme disabledSelectedTheme;
0264:
0265:            // /**
0266:            // * Contains classes of all controls that should be painted as active.
0267:            // */
0268:            // protected Collection<Class> activeControls;
0269:            //
0270:            /**
0271:             * Simple constructor. This constructor is part of officially supported API.
0272:             * 
0273:             * @param colorScheme
0274:             *            Color scheme for <code>this</code> theme.
0275:             * @param displayName
0276:             *            Display name for <code>this</code> theme.
0277:             * @param themeKind
0278:             *            Kind of <code>this</code> theme.
0279:             */
0280:            public SubstanceTheme(ColorScheme colorScheme, String displayName,
0281:                    ThemeKind themeKind) {
0282:                this .kind = themeKind;
0283:                this .colorScheme = colorScheme;
0284:                this .displayName = displayName;
0285:
0286:                if (colorScheme instanceof  AquaColorScheme)
0287:                    AQUA = colorScheme;
0288:
0289:                // allThemes.put(displayName, this);
0290:                // this.activeControls = new HashSet<Class>();
0291:            }
0292:
0293:            /**
0294:             * Returns the color scheme of <code>this</code> theme. This method is
0295:             * part of officially supported API.
0296:             * 
0297:             * @return Color scheme of <code>this</code> theme.
0298:             */
0299:            public ColorScheme getColorScheme() {
0300:                return this .colorScheme;
0301:            }
0302:
0303:            /**
0304:             * Returns the name of <code>this</code> theme. This method is part of
0305:             * officially supported API.
0306:             * 
0307:             * @return The name of <code>this</code> theme.
0308:             */
0309:            public String getThemeName() {
0310:                return this .getDisplayName();
0311:            }
0312:
0313:            /**
0314:             * Adds theme-specific entries to the UI defaults table.
0315:             * 
0316:             * @param table
0317:             *            UI defaults table.
0318:             */
0319:            public void addCustomEntriesToTable(UIDefaults table) {
0320:                // Apparently this function is called with null table
0321:                // when the application is run with -Dswing.defaultlaf
0322:                // setting. In this case, this function will be called
0323:                // second time with correct table.
0324:                if (table == null) {
0325:                    return;
0326:                }
0327:
0328:                Object menuArrowIcon = new UIDefaults.LazyValue() {
0329:                    public Object createValue(UIDefaults table) {
0330:                        return new MenuArrowIcon(null);
0331:                    }
0332:                };
0333:
0334:                Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
0335:                    public Object createValue(UIDefaults table) {
0336:                        return new SubstanceDefaultListCellRenderer.SubstanceUIResource();
0337:                    }
0338:                };
0339:
0340:                Color controlText = new ColorUIResource(this .colorScheme
0341:                        .getLightColor());
0342:                final Color foregroundColor = this .getForegroundColor();
0343:
0344:                Color backgroundColor = new ColorUIResource(this 
0345:                        .getBackgroundColor());
0346:                Color backgroundLightColor = new ColorUIResource(this 
0347:                        .getLightBackgroundColor());
0348:
0349:                Color disabledForegroundColor = new ColorUIResource(this 
0350:                        .getDisabledTheme().getForegroundColor());
0351:                //
0352:                // new ColorUIResource(this.getDisabledForegroundColor());
0353:                // Color disabledBackgroundColor = new ColorUIResource(this
0354:                // .getDisabledBackgroundColor());
0355:
0356:                Color lineColor = new ColorUIResource(this .getLineColor());
0357:
0358:                Color lineColorDefault = new ColorUIResource(this 
0359:                        .getLineColorDefault());
0360:
0361:                int lcb = SubstanceColorUtilities.getColorBrightness(lineColor
0362:                        .getRGB());
0363:                Color lineBwColor = new ColorUIResource(
0364:                        new Color(lcb, lcb, lcb));
0365:
0366:                Color selectionBackgroundColor = new ColorUIResource(this 
0367:                        .getSelectionBackgroundColor());
0368:
0369:                Color selectionForegroundColor = new ColorUIResource(this 
0370:                        .getSelectionForegroundColor());
0371:
0372:                Color selectionCellForegroundColor = new ColorUIResource(this 
0373:                        .getSelectionCellForegroundColor());
0374:
0375:                Object regularMarginBorder = new BorderUIResource.CompoundBorderUIResource(
0376:                        new SubstanceBorder(), new BasicBorders.MarginBorder());
0377:
0378:                Object textBorder = new BorderUIResource.CompoundBorderUIResource(
0379:                        new SubstanceBorder(SubstanceSizeUtils
0380:                                .getTextBorderInsets(SubstanceSizeUtils
0381:                                        .getControlFontSize())),
0382:                        new BasicBorders.MarginBorder());
0383:
0384:                Object comboBorder = new SubstanceBorder(SubstanceSizeUtils
0385:                        .getComboBorderInsets(SubstanceSizeUtils
0386:                                .getControlFontSize()));
0387:
0388:                Object spinnerBorder = new BorderUIResource.CompoundBorderUIResource(
0389:                        new SubstanceBorder(SubstanceSizeUtils
0390:                                .getSpinnerBorderInsets(SubstanceSizeUtils
0391:                                        .getControlFontSize())),
0392:                        new BasicBorders.MarginBorder());
0393:
0394:                ColorScheme activeScheme = this .getActiveTheme()
0395:                        .getColorScheme();
0396:
0397:                ColorScheme defaultScheme = this .getDefaultColorScheme();
0398:
0399:                // special handling of mixed dark themes
0400:                final SubstanceTheme topDecorationTheme = this 
0401:                        .getActiveTitlePaneTheme();
0402:
0403:                int menuItemMargin = SubstanceSizeUtils
0404:                        .getMenuItemMargin(SubstanceSizeUtils
0405:                                .getComponentFontSize(null));
0406:                Insets menuItemInsets = new InsetsUIResource(menuItemMargin,
0407:                        menuItemMargin, menuItemMargin, menuItemMargin);
0408:
0409:                Object fieldInputMap = new UIDefaults.LazyInputMap(
0410:                        new Object[] {
0411:                                "ctrl C",
0412:                                DefaultEditorKit.copyAction,
0413:
0414:                                "ctrl V",
0415:                                DefaultEditorKit.pasteAction,
0416:
0417:                                "ctrl X",
0418:                                DefaultEditorKit.cutAction,
0419:
0420:                                "COPY",
0421:                                DefaultEditorKit.copyAction,
0422:
0423:                                "PASTE",
0424:                                DefaultEditorKit.pasteAction,
0425:
0426:                                "CUT",
0427:                                DefaultEditorKit.cutAction,
0428:
0429:                                "shift LEFT",
0430:                                DefaultEditorKit.selectionBackwardAction,
0431:
0432:                                "shift KP_LEFT",
0433:                                DefaultEditorKit.selectionBackwardAction,
0434:
0435:                                "shift RIGHT",
0436:                                DefaultEditorKit.selectionForwardAction,
0437:
0438:                                "shift KP_RIGHT",
0439:                                DefaultEditorKit.selectionForwardAction,
0440:
0441:                                "ctrl LEFT",
0442:                                DefaultEditorKit.previousWordAction,
0443:
0444:                                "ctrl KP_LEFT",
0445:                                DefaultEditorKit.previousWordAction,
0446:
0447:                                "ctrl RIGHT",
0448:                                DefaultEditorKit.nextWordAction,
0449:
0450:                                "ctrl KP_RIGHT",
0451:                                DefaultEditorKit.nextWordAction,
0452:
0453:                                "ctrl shift LEFT",
0454:                                DefaultEditorKit.selectionPreviousWordAction,
0455:
0456:                                "ctrl shift KP_LEFT",
0457:                                DefaultEditorKit.selectionPreviousWordAction,
0458:
0459:                                "ctrl shift RIGHT",
0460:                                DefaultEditorKit.selectionNextWordAction,
0461:
0462:                                "ctrl shift KP_RIGHT",
0463:                                DefaultEditorKit.selectionNextWordAction,
0464:
0465:                                "ctrl A",
0466:                                DefaultEditorKit.selectAllAction,
0467:
0468:                                "HOME",
0469:                                DefaultEditorKit.beginLineAction,
0470:
0471:                                "END",
0472:                                DefaultEditorKit.endLineAction,
0473:
0474:                                "shift HOME",
0475:                                DefaultEditorKit.selectionBeginLineAction,
0476:
0477:                                "shift END",
0478:                                DefaultEditorKit.selectionEndLineAction,
0479:
0480:                                "BACK_SPACE",
0481:                                DefaultEditorKit.deletePrevCharAction,
0482:
0483:                                "ctrl H",
0484:                                DefaultEditorKit.deletePrevCharAction,
0485:
0486:                                "DELETE",
0487:                                DefaultEditorKit.deleteNextCharAction,
0488:
0489:                                "RIGHT",
0490:                                DefaultEditorKit.forwardAction,
0491:
0492:                                "LEFT",
0493:                                DefaultEditorKit.backwardAction,
0494:
0495:                                "KP_RIGHT",
0496:                                DefaultEditorKit.forwardAction,
0497:
0498:                                "KP_LEFT",
0499:                                DefaultEditorKit.backwardAction,
0500:
0501:                                "ENTER",
0502:                                JTextField.notifyAction,
0503:
0504:                                "ctrl BACK_SLASH",
0505:                                "unselect"/* DefaultEditorKit.unselectAction */,
0506:
0507:                                "control shift O",
0508:                                "toggle-componentOrientation"/* DefaultEditorKit.toggleComponentOrientation */
0509:                        });
0510:
0511:                Object passwordInputMap = new UIDefaults.LazyInputMap(
0512:                        new Object[] {
0513:                                "ctrl C",
0514:                                DefaultEditorKit.copyAction,
0515:
0516:                                "ctrl V",
0517:                                DefaultEditorKit.pasteAction,
0518:
0519:                                "ctrl X",
0520:                                DefaultEditorKit.cutAction,
0521:
0522:                                "COPY",
0523:                                DefaultEditorKit.copyAction,
0524:
0525:                                "PASTE",
0526:                                DefaultEditorKit.pasteAction,
0527:
0528:                                "CUT",
0529:                                DefaultEditorKit.cutAction,
0530:
0531:                                "shift LEFT",
0532:                                DefaultEditorKit.selectionBackwardAction,
0533:
0534:                                "shift KP_LEFT",
0535:                                DefaultEditorKit.selectionBackwardAction,
0536:
0537:                                "shift RIGHT",
0538:                                DefaultEditorKit.selectionForwardAction,
0539:
0540:                                "shift KP_RIGHT",
0541:                                DefaultEditorKit.selectionForwardAction,
0542:
0543:                                "ctrl LEFT",
0544:                                DefaultEditorKit.beginLineAction,
0545:
0546:                                "ctrl KP_LEFT",
0547:                                DefaultEditorKit.beginLineAction,
0548:
0549:                                "ctrl RIGHT",
0550:                                DefaultEditorKit.endLineAction,
0551:
0552:                                "ctrl KP_RIGHT",
0553:                                DefaultEditorKit.endLineAction,
0554:
0555:                                "ctrl shift LEFT",
0556:                                DefaultEditorKit.selectionBeginLineAction,
0557:
0558:                                "ctrl shift KP_LEFT",
0559:                                DefaultEditorKit.selectionBeginLineAction,
0560:
0561:                                "ctrl shift RIGHT",
0562:                                DefaultEditorKit.selectionEndLineAction,
0563:
0564:                                "ctrl shift KP_RIGHT",
0565:                                DefaultEditorKit.selectionEndLineAction,
0566:
0567:                                "ctrl A",
0568:                                DefaultEditorKit.selectAllAction,
0569:
0570:                                "HOME",
0571:                                DefaultEditorKit.beginLineAction,
0572:
0573:                                "END",
0574:                                DefaultEditorKit.endLineAction,
0575:
0576:                                "shift HOME",
0577:                                DefaultEditorKit.selectionBeginLineAction,
0578:
0579:                                "shift END",
0580:                                DefaultEditorKit.selectionEndLineAction,
0581:
0582:                                "BACK_SPACE",
0583:                                DefaultEditorKit.deletePrevCharAction,
0584:
0585:                                "ctrl H",
0586:                                DefaultEditorKit.deletePrevCharAction,
0587:
0588:                                "DELETE",
0589:                                DefaultEditorKit.deleteNextCharAction,
0590:
0591:                                "RIGHT",
0592:                                DefaultEditorKit.forwardAction,
0593:
0594:                                "LEFT",
0595:                                DefaultEditorKit.backwardAction,
0596:
0597:                                "KP_RIGHT",
0598:                                DefaultEditorKit.forwardAction,
0599:
0600:                                "KP_LEFT",
0601:                                DefaultEditorKit.backwardAction,
0602:
0603:                                "ENTER",
0604:                                JTextField.notifyAction,
0605:
0606:                                "ctrl BACK_SLASH",
0607:                                "unselect"/* DefaultEditorKit.unselectAction */,
0608:
0609:                                "control shift O",
0610:                                "toggle-componentOrientation"/* DefaultEditorKit.toggleComponentOrientation */
0611:                        });
0612:
0613:                Object multilineInputMap = new UIDefaults.LazyInputMap(
0614:                        new Object[] {
0615:                                "ctrl C",
0616:                                DefaultEditorKit.copyAction,
0617:
0618:                                "ctrl V",
0619:                                DefaultEditorKit.pasteAction,
0620:
0621:                                "ctrl X",
0622:                                DefaultEditorKit.cutAction,
0623:
0624:                                "COPY",
0625:                                DefaultEditorKit.copyAction,
0626:
0627:                                "PASTE",
0628:                                DefaultEditorKit.pasteAction,
0629:
0630:                                "CUT",
0631:                                DefaultEditorKit.cutAction,
0632:
0633:                                "shift LEFT",
0634:                                DefaultEditorKit.selectionBackwardAction,
0635:
0636:                                "shift KP_LEFT",
0637:                                DefaultEditorKit.selectionBackwardAction,
0638:
0639:                                "shift RIGHT",
0640:                                DefaultEditorKit.selectionForwardAction,
0641:
0642:                                "shift KP_RIGHT",
0643:                                DefaultEditorKit.selectionForwardAction,
0644:
0645:                                "ctrl LEFT",
0646:                                DefaultEditorKit.previousWordAction,
0647:
0648:                                "ctrl KP_LEFT",
0649:                                DefaultEditorKit.previousWordAction,
0650:
0651:                                "ctrl RIGHT",
0652:                                DefaultEditorKit.nextWordAction,
0653:
0654:                                "ctrl KP_RIGHT",
0655:                                DefaultEditorKit.nextWordAction,
0656:
0657:                                "ctrl shift LEFT",
0658:                                DefaultEditorKit.selectionPreviousWordAction,
0659:
0660:                                "ctrl shift KP_LEFT",
0661:                                DefaultEditorKit.selectionPreviousWordAction,
0662:
0663:                                "ctrl shift RIGHT",
0664:                                DefaultEditorKit.selectionNextWordAction,
0665:
0666:                                "ctrl shift KP_RIGHT",
0667:                                DefaultEditorKit.selectionNextWordAction,
0668:
0669:                                "ctrl A",
0670:                                DefaultEditorKit.selectAllAction,
0671:
0672:                                "HOME",
0673:                                DefaultEditorKit.beginLineAction,
0674:
0675:                                "END",
0676:                                DefaultEditorKit.endLineAction,
0677:
0678:                                "shift HOME",
0679:                                DefaultEditorKit.selectionBeginLineAction,
0680:
0681:                                "shift END",
0682:                                DefaultEditorKit.selectionEndLineAction,
0683:
0684:                                "UP",
0685:                                DefaultEditorKit.upAction,
0686:
0687:                                "KP_UP",
0688:                                DefaultEditorKit.upAction,
0689:
0690:                                "DOWN",
0691:                                DefaultEditorKit.downAction,
0692:
0693:                                "KP_DOWN",
0694:                                DefaultEditorKit.downAction,
0695:
0696:                                "PAGE_UP",
0697:                                DefaultEditorKit.pageUpAction,
0698:
0699:                                "PAGE_DOWN",
0700:                                DefaultEditorKit.pageDownAction,
0701:
0702:                                "shift PAGE_UP",
0703:                                "selection-page-up",
0704:
0705:                                "shift PAGE_DOWN",
0706:                                "selection-page-down",
0707:
0708:                                "ctrl shift PAGE_UP",
0709:                                "selection-page-left",
0710:
0711:                                "ctrl shift PAGE_DOWN",
0712:                                "selection-page-right",
0713:
0714:                                "shift UP",
0715:                                DefaultEditorKit.selectionUpAction,
0716:
0717:                                "shift KP_UP",
0718:                                DefaultEditorKit.selectionUpAction,
0719:
0720:                                "shift DOWN",
0721:                                DefaultEditorKit.selectionDownAction,
0722:
0723:                                "shift KP_DOWN",
0724:                                DefaultEditorKit.selectionDownAction,
0725:
0726:                                "ENTER",
0727:                                DefaultEditorKit.insertBreakAction,
0728:
0729:                                "BACK_SPACE",
0730:                                DefaultEditorKit.deletePrevCharAction,
0731:
0732:                                "ctrl H",
0733:                                DefaultEditorKit.deletePrevCharAction,
0734:
0735:                                "DELETE",
0736:                                DefaultEditorKit.deleteNextCharAction,
0737:
0738:                                "RIGHT",
0739:                                DefaultEditorKit.forwardAction,
0740:
0741:                                "LEFT",
0742:                                DefaultEditorKit.backwardAction,
0743:
0744:                                "KP_RIGHT",
0745:                                DefaultEditorKit.forwardAction,
0746:
0747:                                "KP_LEFT",
0748:                                DefaultEditorKit.backwardAction,
0749:
0750:                                "TAB",
0751:                                DefaultEditorKit.insertTabAction,
0752:
0753:                                "ctrl BACK_SLASH",
0754:                                "unselect"/* DefaultEditorKit.unselectAction */,
0755:
0756:                                "ctrl HOME", DefaultEditorKit.beginAction,
0757:
0758:                                "ctrl END", DefaultEditorKit.endAction,
0759:
0760:                                "ctrl shift HOME",
0761:                                DefaultEditorKit.selectionBeginAction,
0762:
0763:                                "ctrl shift END",
0764:                                DefaultEditorKit.selectionEndAction,
0765:
0766:                                "ctrl T", "next-link-action",
0767:
0768:                                "ctrl shift T", "previous-link-action",
0769:
0770:                                "ctrl SPACE", "activate-link-action",
0771:
0772:                                "control shift O",
0773:                                "toggle-componentOrientation"/* DefaultEditorKit.toggleComponentOrientation */
0774:                        });
0775:
0776:                Icon emptyIcon = new IconUIResource(new Icon() {
0777:                    public int getIconHeight() {
0778:                        return 2;
0779:                    }
0780:
0781:                    public int getIconWidth() {
0782:                        return 2;
0783:                    }
0784:
0785:                    public void paintIcon(Component c, Graphics g, int x, int y) {
0786:                    }
0787:                });
0788:
0789:                Object[] defaults = new Object[] {
0790:                        "control",
0791:                        controlText,
0792:
0793:                        "TextField.focusInputMap",
0794:                        fieldInputMap,
0795:
0796:                        "PasswordField.focusInputMap",
0797:                        passwordInputMap,
0798:
0799:                        "TextArea.focusInputMap",
0800:                        multilineInputMap,
0801:
0802:                        "TextPane.focusInputMap",
0803:                        multilineInputMap,
0804:
0805:                        "EditorPane.focusInputMap",
0806:                        multilineInputMap,
0807:
0808:                        // "MenuBarUI",
0809:                        // "org.jvnet.substance.SubstanceMenuBarUI",
0810:
0811:                        "Button.defaultButtonFollowsFocus",
0812:                        Boolean.FALSE,
0813:
0814:                        "Button.disabledText",
0815:                        disabledForegroundColor,
0816:
0817:                        "Button.foreground",
0818:                        foregroundColor,
0819:
0820:                        "Button.margin",
0821:                        new InsetsUIResource(0, 0, 0, 0),
0822:
0823:                        "CheckBox.background",
0824:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0825:                                JCheckBox.class, this ),
0826:
0827:                        "CheckBox.border",
0828:                        new BorderUIResource.CompoundBorderUIResource(
0829:                                SubstanceSizeUtils
0830:                                        .getCheckBoxBorder(SubstanceSizeUtils
0831:                                                .getControlFontSize()),
0832:                                new MarginBorder()),
0833:
0834:                        "CheckBox.disabledText",
0835:                        disabledForegroundColor,
0836:
0837:                        "CheckBox.foreground",
0838:                        foregroundColor,
0839:
0840:                        "CheckBoxMenuItem.acceleratorForeground",
0841:                        foregroundColor,
0842:
0843:                        "CheckBoxMenuItem.acceleratorSelectionForeground",
0844:                        foregroundColor,
0845:
0846:                        "CheckBoxMenuItem.background",
0847:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0848:                                JCheckBoxMenuItem.class, this ),
0849:
0850:                        "CheckBoxMenuItem.borderPainted",
0851:                        Boolean.FALSE,
0852:
0853:                        "CheckBoxMenuItem.checkIcon",
0854:                        new CheckBoxMenuItemIcon(null, 1 + SubstanceSizeUtils
0855:                                .getMenuCheckMarkSize(SubstanceSizeUtils
0856:                                        .getControlFontSize())),
0857:                        // new UIDefaults.LazyValue() {
0858:                        // public Object createValue(UIDefaults table) {
0859:                        // return new IconUIResource(SubstanceIconFactory
0860:                        // .getCheckBoxMenuItemIcon(1 + SubstanceSizeUtils
0861:                        // .getMenuCheckMarkSize()));
0862:                        // }
0863:                        // },
0864:
0865:                        "CheckBoxMenuItem.disabledForeground",
0866:                        disabledForegroundColor,
0867:
0868:                        "CheckBoxMenuItem.foreground",
0869:                        foregroundColor,
0870:
0871:                        "CheckBoxMenuItem.margin",
0872:                        menuItemInsets,
0873:
0874:                        "CheckBoxMenuItem.selectionForeground",
0875:                        selectionCellForegroundColor,
0876:
0877:                        "ColorChooser.background",
0878:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0879:                                JColorChooser.class, this ),
0880:
0881:                        "ColorChooser.foreground",
0882:                        foregroundColor,
0883:
0884:                        "ComboBox.ancestorInputMap",
0885:                        new UIDefaults.LazyInputMap(new Object[] { "ESCAPE",
0886:                                "hidePopup",
0887:
0888:                                "PAGE_UP", "pageUpPassThrough",
0889:
0890:                                "PAGE_DOWN", "pageDownPassThrough",
0891:
0892:                                "HOME", "homePassThrough",
0893:
0894:                                "END", "endPassThrough",
0895:
0896:                                "DOWN", "selectNext",
0897:
0898:                                "KP_DOWN", "selectNext",
0899:
0900:                                "alt DOWN", "togglePopup",
0901:
0902:                                "alt KP_DOWN", "togglePopup",
0903:
0904:                                "alt UP", "togglePopup",
0905:
0906:                                "alt KP_UP", "togglePopup",
0907:
0908:                                "SPACE", "spacePopup",
0909:
0910:                                "ENTER", "enterPressed",
0911:
0912:                                "UP", "selectPrevious",
0913:
0914:                                "KP_UP", "selectPrevious" }),
0915:
0916:                        "ComboBox.background",
0917:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0918:                                JComboBox.class, this ),
0919:
0920:                        "ComboBox.border",
0921:                        comboBorder,
0922:
0923:                        "ComboBox.disabledBackground",
0924:                        backgroundLightColor,
0925:
0926:                        "ComboBox.disabledForeground",
0927:                        disabledForegroundColor,
0928:
0929:                        "ComboBox.foreground",
0930:                        foregroundColor,
0931:
0932:                        "ComboBox.selectionBackground",
0933:                        backgroundLightColor,
0934:
0935:                        "ComboBox.selectionForeground",
0936:                        foregroundColor,
0937:
0938:                        "DesktopIcon.border",
0939:                        regularMarginBorder,
0940:
0941:                        "DesktopIcon.width",
0942:                        new Integer(140),
0943:
0944:                        "Desktop.background",
0945:                        new ColorUIResource(new Color(0x0, true)),
0946:
0947:                        "Desktop.foreground",
0948:                        foregroundColor,
0949:
0950:                        "Dialog.background",
0951:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0952:                                JDialog.class, this ),
0953:
0954:                        "EditorPane.background",
0955:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0956:                                JEditorPane.class, this ),
0957:
0958:                        "EditorPane.border",
0959:                        textBorder,
0960:
0961:                        "EditorPane.foreground",
0962:                        foregroundColor,
0963:
0964:                        "EditorPane.caretForeground",
0965:                        foregroundColor,
0966:
0967:                        "EditorPane.disabledBackground",
0968:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0969:                                JEditorPane.class, this .getDisabledTheme()),
0970:
0971:                        "EditorPane.inactiveBackground",
0972:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
0973:                                JEditorPane.class, this .getDisabledTheme()),
0974:
0975:                        "EditorPane.inactiveForeground",
0976:                        disabledForegroundColor,
0977:
0978:                        "EditorPane.selectionBackground",
0979:                        selectionBackgroundColor,
0980:
0981:                        "EditorPane.selectionForeground",
0982:                        selectionForegroundColor,
0983:
0984:                        "FileChooser.upFolderIcon",
0985:                        new UIDefaults.LazyValue() {
0986:                            public Object createValue(UIDefaults table) {
0987:                                return SubstanceCoreUtilities
0988:                                        .getIcon("resource/go-up.png");
0989:                            }
0990:                        },
0991:
0992:                        "FileChooser.newFolderIcon",
0993:                        new UIDefaults.LazyValue() {
0994:                            public Object createValue(UIDefaults table) {
0995:                                return SubstanceCoreUtilities
0996:                                        .getIcon("resource/folder-new.png");
0997:                            }
0998:                        },
0999:
1000:                        "FileChooser.homeFolderIcon",
1001:                        new UIDefaults.LazyValue() {
1002:                            public Object createValue(UIDefaults table) {
1003:                                return SubstanceCoreUtilities
1004:                                        .getIcon("resource/user-home.png");
1005:                            }
1006:                        },
1007:
1008:                        "FileChooser.listViewIcon",
1009:                        new UIDefaults.LazyValue() {
1010:                            public Object createValue(UIDefaults table) {
1011:                                return SubstanceCoreUtilities
1012:                                        .getIcon("resource/application_view_list.png");
1013:                            }
1014:                        },
1015:
1016:                        "FileChooser.detailsViewIcon",
1017:                        new UIDefaults.LazyValue() {
1018:                            public Object createValue(UIDefaults table) {
1019:                                return SubstanceCoreUtilities
1020:                                        .getIcon("resource/application_view_detail.png");
1021:                            }
1022:                        },
1023:
1024:                        "FileChooser.viewMenuLabelText",
1025:                        "View",
1026:
1027:                        "FileChooser.refreshActionLabelText",
1028:                        "Refresh",
1029:
1030:                        "FileChooser.newFolderActionLabelText",
1031:                        "New Folder",
1032:
1033:                        "FileChooser.listViewActionLabelText",
1034:                        "List",
1035:
1036:                        "FileChooser.detailsViewActionLabelText",
1037:                        "Details",
1038:
1039:                        "FileChooser.lookInLabelMnemonic",
1040:                        new Integer(KeyEvent.VK_I),
1041:
1042:                        "FileChooser.fileNameLabelMnemonic",
1043:                        new Integer(KeyEvent.VK_N),
1044:
1045:                        "FileChooser.filesOfTypeLabelMnemonic",
1046:                        new Integer(KeyEvent.VK_T),
1047:
1048:                        "FileChooser.usesSingleFilePane",
1049:                        Boolean.TRUE,
1050:
1051:                        "FileChooser.ancestorInputMap",
1052:                        new UIDefaults.LazyInputMap(new Object[] { "ESCAPE",
1053:                                "cancelSelection", "F2", "editFileName", "F5",
1054:                                "refresh", "BACK_SPACE", "Go Up", "ENTER",
1055:                                "approveSelection" }),
1056:
1057:                        "FileView.computerIcon",
1058:                        new UIDefaults.LazyValue() {
1059:                            public Object createValue(UIDefaults table) {
1060:                                return SubstanceCoreUtilities
1061:                                        .getIcon("resource/computer.png");
1062:                            }
1063:                        },
1064:
1065:                        "FileView.directoryIcon",
1066:                        new UIDefaults.LazyValue() {
1067:                            public Object createValue(UIDefaults table) {
1068:                                return SubstanceCoreUtilities
1069:                                        .getIcon("resource/folder.png");
1070:                            }
1071:                        },
1072:
1073:                        "FileView.fileIcon",
1074:                        new UIDefaults.LazyValue() {
1075:                            public Object createValue(UIDefaults table) {
1076:                                return SubstanceCoreUtilities
1077:                                        .getIcon("resource/text-x-generic.png");
1078:                            }
1079:                        },
1080:
1081:                        "FileView.floppyDriveIcon",
1082:                        new UIDefaults.LazyValue() {
1083:                            public Object createValue(UIDefaults table) {
1084:                                return SubstanceCoreUtilities
1085:                                        .getIcon("resource/media-floppy.png");
1086:                            }
1087:                        },
1088:
1089:                        "FileView.hardDriveIcon",
1090:                        new UIDefaults.LazyValue() {
1091:                            public Object createValue(UIDefaults table) {
1092:                                return SubstanceCoreUtilities
1093:                                        .getIcon("resource/drive-harddisk.png");
1094:                            }
1095:                        },
1096:
1097:                        "FormattedTextField.background",
1098:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1099:                                JFormattedTextField.class, this ),
1100:
1101:                        "FormattedTextField.border",
1102:                        textBorder,
1103:
1104:                        "FormattedTextField.caretForeground",
1105:                        foregroundColor,
1106:
1107:                        "FormattedTextField.disabledBackground",
1108:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1109:                                JFormattedTextField.class, this 
1110:                                        .getDisabledTheme()),
1111:
1112:                        "FormattedTextField.foreground",
1113:                        foregroundColor,
1114:
1115:                        "FormattedTextField.inactiveBackground",
1116:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1117:                                JFormattedTextField.class, this 
1118:                                        .getDisabledTheme()),
1119:
1120:                        "FormattedTextField.inactiveForeground",
1121:                        disabledForegroundColor,
1122:
1123:                        "FormattedTextField.selectionBackground",
1124:                        selectionBackgroundColor,
1125:
1126:                        "FormattedTextField.selectionForeground",
1127:                        selectionForegroundColor,
1128:
1129:                        "InternalFrame.activeTitleBackground",
1130:                        selectionForegroundColor,
1131:
1132:                        "InternalFrame.inactiveTitleBackground",
1133:                        foregroundColor,
1134:
1135:                        // "InternalFrame.activeTitleGradient",
1136:                        // selectionBackgroundColor,
1137:                        //
1138:                        // "InternalFrame.inactiveTitleGradient",
1139:                        // backgroundColor,
1140:
1141:                        "InternalFrame.border",
1142:                        new BorderUIResource(new SubstancePaneBorder()),
1143:
1144:                        "InternalFrame.closeIcon",
1145:                        new UIDefaults.LazyValue() {
1146:                            public Object createValue(UIDefaults table) {
1147:                                return SubstanceImageCreator
1148:                                        .getCloseIcon(topDecorationTheme);
1149:                            }
1150:                        },
1151:
1152:                        "InternalFrame.iconifyIcon",
1153:                        new UIDefaults.LazyValue() {
1154:                            public Object createValue(UIDefaults table) {
1155:                                return SubstanceImageCreator
1156:                                        .getMinimizeIcon(topDecorationTheme);
1157:                            }
1158:                        },
1159:
1160:                        // maximize2
1161:                        "InternalFrame.maximizeIcon",
1162:                        new UIDefaults.LazyValue() {
1163:                            public Object createValue(UIDefaults table) {
1164:                                return SubstanceImageCreator
1165:                                        .getMaximizeIcon(topDecorationTheme);
1166:                            }
1167:                        },
1168:
1169:                        // restore
1170:                        "InternalFrame.minimizeIcon",
1171:                        new UIDefaults.LazyValue() {
1172:                            public Object createValue(UIDefaults table) {
1173:                                return SubstanceImageCreator
1174:                                        .getRestoreIcon(topDecorationTheme);
1175:                            }
1176:                        },
1177:
1178:                        "InternalFrame.paletteCloseIcon",
1179:                        new UIDefaults.LazyValue() {
1180:                            public Object createValue(UIDefaults table) {
1181:                                return SubstanceImageCreator
1182:                                        .getCloseIcon(topDecorationTheme);
1183:                            }
1184:                        },
1185:
1186:                        "Label.background",
1187:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1188:                                JLabel.class, this ),
1189:
1190:                        "Label.foreground",
1191:                        foregroundColor,
1192:
1193:                        "Label.disabledText",
1194:                        disabledForegroundColor,
1195:
1196:                        "Label.disabledForeground",
1197:                        disabledForegroundColor,
1198:
1199:                        "List.background",
1200:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1201:                                JList.class, this ),
1202:
1203:                        "List.cellRenderer",
1204:                        listCellRendererActiveValue,
1205:
1206:                        "List.focusCellHighlightBorder",
1207:                        new SubstanceBorder(new Insets(1, 1, 1, 1)),
1208:
1209:                        "List.focusSelectedCellHighlightBorder",
1210:                        new BorderUIResource.EmptyBorderUIResource(1, 1, 1, 1),
1211:                        // new SubstanceBorder(new Insets(1, 1, 1, 1)),
1212:
1213:                        "List.foreground",
1214:                        foregroundColor,
1215:
1216:                        "List.selectionBackground",
1217:                        new ColorUIResource(activeScheme.getLightColor()),
1218:
1219:                        "List.selectionForeground",
1220:                        selectionCellForegroundColor,
1221:
1222:                        "Menu.arrowIcon",
1223:                        menuArrowIcon,
1224:
1225:                        "Menu.background",
1226:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1227:                                JMenu.class, this ),
1228:
1229:                        "Menu.borderPainted",
1230:                        Boolean.FALSE,
1231:
1232:                        "Menu.checkIcon",
1233:                        null,
1234:
1235:                        "Menu.disabledForeground",
1236:                        disabledForegroundColor,
1237:
1238:                        "Menu.foreground",
1239:                        foregroundColor,
1240:
1241:                        "Menu.margin",
1242:                        menuItemInsets,
1243:
1244:                        "Menu.selectionForeground",
1245:                        selectionCellForegroundColor,
1246:
1247:                        "MenuBar.background",
1248:                        this .toUseDecorationPainter(DecorationAreaType.HEADER) ? new ColorUIResource(
1249:                                this .getDecorationTheme(
1250:                                        DecorationAreaType.HEADER)
1251:                                        .getColorScheme().getMidColor())
1252:                                : SubstanceCoreUtilities
1253:                                        .getDefaultBackgroundColor(
1254:                                                JMenuBar.class, this ),
1255:                        // shouldUseHeaderPainter ? new ColorUIResource(this
1256:                        // .getActiveTitlePaneTheme().getColorScheme()
1257:                        // .getMidColor()) : backgroundColor,
1258:
1259:                        "MenuBar.foreground",
1260:                        new ColorUIResource(this .getDecorationTheme(
1261:                                DecorationAreaType.HEADER).getColorScheme()
1262:                                .getForegroundColor()),
1263:                        // shouldUseHeaderPainter ? new ColorUIResource(this
1264:                        // .getActiveTitlePaneTheme().getForegroundColor())
1265:                        // : foregroundColor,
1266:
1267:                        "MenuBar.border",
1268:                        null,
1269:
1270:                        "MenuItem.acceleratorForeground",
1271:                        foregroundColor,
1272:
1273:                        "MenuItem.acceleratorSelectionForeground",
1274:                        foregroundColor,
1275:
1276:                        "MenuItem.background",
1277:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1278:                                JMenuItem.class, this ),
1279:
1280:                        "MenuItem.borderPainted",
1281:                        Boolean.FALSE,
1282:
1283:                        "MenuItem.checkIcon",
1284:                        null,
1285:
1286:                        "MenuItem.disabledForeground",
1287:                        disabledForegroundColor,
1288:
1289:                        "MenuItem.foreground",
1290:                        foregroundColor,
1291:
1292:                        "MenuItem.margin",
1293:                        menuItemInsets,
1294:
1295:                        "MenuItem.selectionForeground",
1296:                        selectionCellForegroundColor,
1297:
1298:                        "OptionPane.background",
1299:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1300:                                JOptionPane.class, this ),
1301:
1302:                        "OptionPane.errorIcon",
1303:                        new UIDefaults.LazyValue() {
1304:                            public Object createValue(UIDefaults table) {
1305:                                return SubstanceCoreUtilities
1306:                                        .getIcon("resource/32/dialog-error.png");
1307:                            }
1308:                        },
1309:
1310:                        "OptionPane.foreground",
1311:                        foregroundColor,
1312:
1313:                        "OptionPane.informationIcon",
1314:                        new UIDefaults.LazyValue() {
1315:                            public Object createValue(UIDefaults table) {
1316:                                return SubstanceCoreUtilities
1317:                                        .getIcon("resource/32/dialog-information.png");
1318:                            }
1319:                        },
1320:
1321:                        "OptionPane.messageForeground",
1322:                        foregroundColor,
1323:
1324:                        "OptionPane.questionIcon",
1325:                        new UIDefaults.LazyValue() {
1326:                            public Object createValue(UIDefaults table) {
1327:                                return SubstanceCoreUtilities
1328:                                        .getIcon("resource/32/help-browser.png");
1329:                            }
1330:                        },
1331:
1332:                        "OptionPane.warningIcon",
1333:                        new UIDefaults.LazyValue() {
1334:                            public Object createValue(UIDefaults table) {
1335:                                return SubstanceCoreUtilities
1336:                                        .getIcon("resource/32/dialog-warning.png");
1337:                            }
1338:                        },
1339:
1340:                        "Panel.background",
1341:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1342:                                JPanel.class, this ),
1343:
1344:                        "Panel.foreground",
1345:                        foregroundColor,
1346:
1347:                        "PasswordField.background",
1348:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1349:                                JPasswordField.class, this ),
1350:
1351:                        "PasswordField.border",
1352:                        textBorder,
1353:
1354:                        "PasswordField.caretForeground",
1355:                        foregroundColor,
1356:
1357:                        "PasswordField.disabledBackground",
1358:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1359:                                JPasswordField.class, this .getDisabledTheme()),
1360:
1361:                        "PasswordField.foreground",
1362:                        foregroundColor,
1363:
1364:                        "PasswordField.inactiveBackground",
1365:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1366:                                JPasswordField.class, this .getDisabledTheme()),
1367:
1368:                        "PasswordField.inactiveForeground",
1369:                        disabledForegroundColor,
1370:
1371:                        "PasswordField.selectionBackground",
1372:                        selectionBackgroundColor,
1373:
1374:                        "PasswordField.selectionForeground",
1375:                        selectionForegroundColor,
1376:
1377:                        "PopupMenu.background",
1378:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1379:                                JPopupMenu.class, this ),
1380:
1381:                        "PopupMenu.border",
1382:                        regularMarginBorder,
1383:
1384:                        "ProgressBar.border",
1385:                        new BorderUIResource(new SubstanceBorder()),
1386:
1387:                        "ProgressBar.cycleTime",
1388:                        new Integer(1000),
1389:
1390:                        "ProgressBar.repaintInterval",
1391:                        new Integer(50),
1392:
1393:                        "ProgressBar.horizontalSize",
1394:                        new DimensionUIResource(146, SubstanceSizeUtils
1395:                                .getControlFontSize()),
1396:
1397:                        "ProgressBar.verticalSize",
1398:                        new DimensionUIResource(SubstanceSizeUtils
1399:                                .getControlFontSize(), 146),
1400:
1401:                        "ProgressBar.selectionBackground",
1402:                        foregroundColor,
1403:
1404:                        "ProgressBar.selectionForeground",
1405:                        foregroundColor,
1406:
1407:                        "RadioButton.background",
1408:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1409:                                JRadioButton.class, this ),
1410:
1411:                        "RadioButton.border",
1412:                        new BorderUIResource.CompoundBorderUIResource(
1413:                                SubstanceSizeUtils
1414:                                        .getRadioButtonBorder(SubstanceSizeUtils
1415:                                                .getControlFontSize()),
1416:                                new MarginBorder()),
1417:
1418:                        "RadioButton.foreground",
1419:                        foregroundColor,
1420:
1421:                        "RadioButton.disabledText",
1422:                        disabledForegroundColor,
1423:
1424:                        "RadioButtonMenuItem.acceleratorForeground",
1425:                        foregroundColor,
1426:
1427:                        "RadioButtonMenuItem.acceleratorSelectionForeground",
1428:                        foregroundColor,
1429:
1430:                        "RadioButtonMenuItem.background",
1431:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1432:                                JRadioButtonMenuItem.class, this ),
1433:
1434:                        "RadioButtonMenuItem.borderPainted",
1435:                        Boolean.FALSE,
1436:
1437:                        "RadioButtonMenuItem.checkIcon",
1438:                        new RadioButtonMenuItemIcon(null, SubstanceSizeUtils
1439:                                .getMenuCheckMarkSize(SubstanceSizeUtils
1440:                                        .getControlFontSize())),
1441:
1442:                        "RadioButtonMenuItem.disabledForeground",
1443:                        disabledForegroundColor,
1444:
1445:                        "RadioButtonMenuItem.foreground",
1446:                        foregroundColor,
1447:
1448:                        "RadioButtonMenuItem.margin",
1449:                        menuItemInsets,
1450:
1451:                        "RadioButtonMenuItem.selectionForeground",
1452:                        selectionCellForegroundColor,
1453:
1454:                        "RootPane.background",
1455:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1456:                                JRootPane.class, this ),
1457:
1458:                        "RootPane.border",
1459:                        new SubstancePaneBorder(),
1460:
1461:                        "ScrollBar.background",
1462:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1463:                                JScrollBar.class, this ),
1464:
1465:                        "ScrollBar.width",
1466:                        new Integer(SubstanceSizeUtils
1467:                                .getScrollBarWidth(SubstanceSizeUtils
1468:                                        .getControlFontSize())),
1469:
1470:                        "ScrollBar.minimumThumbSize",
1471:                        new DimensionUIResource(SubstanceSizeUtils
1472:                                .getScrollBarWidth(SubstanceSizeUtils
1473:                                        .getControlFontSize()) - 2,
1474:                                SubstanceSizeUtils
1475:                                        .getScrollBarWidth(SubstanceSizeUtils
1476:                                                .getControlFontSize()) - 2),
1477:
1478:                        "ScrollPane.background",
1479:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1480:                                JScrollPane.class, this ),
1481:
1482:                        "ScrollPane.foreground",
1483:                        foregroundColor,
1484:
1485:                        "ScrollPane.border",
1486:                        new SubstanceScrollPaneBorder(),
1487:
1488:                        "Separator.background",
1489:                        backgroundColor,
1490:
1491:                        "Separator.foreground",
1492:                        lineBwColor,
1493:
1494:                        "Slider.altTrackColor",
1495:                        lineColor,
1496:
1497:                        "Slider.background",
1498:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1499:                                JSlider.class, this ),
1500:
1501:                        "Slider.darkShadow",
1502:                        lineColor,
1503:
1504:                        "Slider.focus",
1505:                        lineColor,
1506:
1507:                        "Slider.focusInsets",
1508:                        new InsetsUIResource(2, 2, 0, 2),
1509:
1510:                        "Slider.foreground",
1511:                        lineColor,
1512:
1513:                        "Slider.highlight",
1514:                        backgroundLightColor,
1515:
1516:                        // "Slider.horizontalThumbIcon",
1517:                        // new UIDefaults.LazyValue() {
1518:                        // public Object createValue(UIDefaults table) {
1519:                        // return SubstanceIconFactory.getSliderHorizontalIcon(16,
1520:                        // false);
1521:                        // }
1522:                        // },
1523:                        //
1524:                        "Slider.shadow",
1525:                        lineColor,
1526:
1527:                        "Slider.tickColor",
1528:                        foregroundColor,
1529:
1530:                        // "Slider.verticalThumbIcon",
1531:                        // new UIDefaults.LazyValue() {
1532:                        // public Object createValue(UIDefaults table) {
1533:                        // return SubstanceIconFactory.getSliderVerticalIcon(16,
1534:                        // false);
1535:                        // }
1536:                        // },
1537:
1538:                        "Spinner.arrowButtonInsets",
1539:                        SubstanceSizeUtils
1540:                                .getSpinnerArrowButtonInsets(SubstanceSizeUtils
1541:                                        .getControlFontSize()),
1542:
1543:                        "Spinner.background",
1544:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1545:                                JSpinner.class, this ),
1546:
1547:                        "Spinner.border",
1548:                        spinnerBorder,
1549:
1550:                        "Spinner.disableOnBoundaryValues",
1551:                        Boolean.TRUE,
1552:
1553:                        "Spinner.foreground",
1554:                        foregroundColor,
1555:
1556:                        "Spinner.editorBorderPainted",
1557:                        Boolean.TRUE,
1558:
1559:                        // "Spinner.arrowButtonInsets",
1560:                        // SubstanceSizeUtils.getSpinnerArrowButtonInsets(),
1561:
1562:                        "SplitPane.background",
1563:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1564:                                JSplitPane.class, this ),
1565:
1566:                        "SplitPane.foreground",
1567:                        foregroundColor,
1568:
1569:                        "SplitPane.dividerFocusColor",
1570:                        backgroundColor,
1571:
1572:                        "SplitPaneDivider.draggingColor",
1573:                        backgroundColor,
1574:
1575:                        "SplitPane.border",
1576:                        new BorderUIResource(new EmptyBorder(0, 0, 0, 0)),
1577:
1578:                        "SplitPane.dividerSize",
1579:                        new Integer(SubstanceSizeUtils
1580:                                .getArrowIconWidth(SubstanceSizeUtils
1581:                                        .getControlFontSize())
1582:                                + SubstanceSizeUtils
1583:                                        .getAdjustedSize(SubstanceSizeUtils
1584:                                                .getControlFontSize(), -1, 6,
1585:                                                -1, true)),
1586:
1587:                        "SplitPaneDivider.border",
1588:                        new BorderUIResource(new EmptyBorder(1, 1, 1, 1)),
1589:
1590:                        "TabbedPane.tabAreaBackground",
1591:                        backgroundColor,
1592:
1593:                        "TabbedPane.unselectedBackground",
1594:                        backgroundColor,
1595:
1596:                        "TabbedPane.background",
1597:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1598:                                JTabbedPane.class, this ),
1599:
1600:                        "TabbedPane.borderHightlightColor",
1601:                        new ColorUIResource(activeScheme.getMidColor()),
1602:
1603:                        "TabbedPane.contentAreaColor",
1604:                        new ColorUIResource(this .colorScheme
1605:                                .getUltraLightColor()),
1606:
1607:                        "TabbedPane.contentBorderInsets",
1608:                        new InsetsUIResource(4, 4, 4, 4),
1609:
1610:                        "TabbedPane.contentOpaque",
1611:                        Boolean.FALSE,
1612:
1613:                        "TabbedPane.darkShadow",
1614:                        (SubstanceCoreUtilities.isThemeDark(this ) ? new ColorUIResource(
1615:                                activeScheme.getDarkColor())
1616:                                : new ColorUIResource(activeScheme
1617:                                        .getMidColor())),
1618:
1619:                        "TabbedPane.focus",
1620:                        foregroundColor,
1621:
1622:                        "TabbedPane.foreground",
1623:                        foregroundColor,
1624:
1625:                        "TabbedPane.highlight",
1626:                        new ColorUIResource(activeScheme.getLightColor()),
1627:
1628:                        "TabbedPane.light",
1629:                        (SubstanceCoreUtilities.isThemeDark(this ) ? new ColorUIResource(
1630:                                SubstanceColorUtilities.getAlphaColor(
1631:                                        defaultScheme.getUltraDarkColor(), 100))
1632:                                : new ColorUIResource(defaultScheme
1633:                                        .getLightColor())),
1634:
1635:                        "TabbedPane.selected",
1636:                        new ColorUIResource(activeScheme.getExtraLightColor()),
1637:
1638:                        "TabbedPane.selectedForeground",
1639:                        foregroundColor,
1640:
1641:                        "TabbedPane.selectHighlight",
1642:                        new ColorUIResource(activeScheme.getMidColor()),
1643:
1644:                        "TabbedPane.shadow",
1645:                        new ColorUIResource(SubstanceColorUtilities
1646:                                .getInterpolatedColor(defaultScheme
1647:                                        .getExtraLightColor(), defaultScheme
1648:                                        .getLightColor(), 0.5)),
1649:
1650:                        "TabbedPane.tabRunOverlay",
1651:                        new Integer(0),
1652:
1653:                        "Table.background",
1654:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1655:                                JTable.class, this ),
1656:
1657:                        "Table.focusCellBackground",
1658:                        backgroundColor,
1659:
1660:                        "Table.focusCellForeground",
1661:                        foregroundColor,
1662:
1663:                        "Table.focusCellHighlightBorder",
1664:                        new SubstanceBorder(),
1665:                        // new UIDefaults.LazyValue() {
1666:                        // public Object createValue(UIDefaults table) {
1667:                        // return new BorderUIResource(new SubstanceBorder());
1668:                        // }
1669:                        // },
1670:
1671:                        "Table.foreground",
1672:                        foregroundColor,
1673:
1674:                        "Table.gridColor",
1675:                        lineColorDefault,
1676:
1677:                        "Table.scrollPaneBorder",
1678:                        new SubstanceScrollPaneBorder(),
1679:
1680:                        "Table.selectionBackground",
1681:                        selectionBackgroundColor,
1682:
1683:                        "Table.selectionForeground",
1684:                        selectionCellForegroundColor,
1685:
1686:                        "TableHeader.cellBorder",
1687:                        null,
1688:
1689:                        "TableHeader.foreground",
1690:                        foregroundColor,
1691:
1692:                        "TableHeader.background",
1693:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1694:                                JTableHeader.class, this ),
1695:
1696:                        "TextArea.background",
1697:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1698:                                JTextArea.class, this ),
1699:
1700:                        "TextArea.border",
1701:                        textBorder,
1702:
1703:                        "TextArea.caretForeground",
1704:                        foregroundColor,
1705:
1706:                        "TextArea.disabledBackground",
1707:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1708:                                JTextArea.class, this .getDisabledTheme()),
1709:
1710:                        "TextArea.foreground",
1711:                        foregroundColor,
1712:
1713:                        "TextArea.inactiveBackground",
1714:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1715:                                JTextArea.class, this .getDisabledTheme()),
1716:
1717:                        "TextArea.inactiveForeground",
1718:                        disabledForegroundColor,
1719:
1720:                        "TextArea.selectionBackground",
1721:                        selectionBackgroundColor,
1722:
1723:                        "TextArea.selectionForeground",
1724:                        selectionForegroundColor,
1725:
1726:                        "TextField.background",
1727:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1728:                                JTextField.class, this ),
1729:
1730:                        "TextField.border",
1731:                        textBorder,
1732:
1733:                        "TextField.caretForeground",
1734:                        foregroundColor,
1735:
1736:                        "TextField.disabledBackground",
1737:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1738:                                JTextField.class, this .getDisabledTheme()),
1739:
1740:                        "TextField.foreground",
1741:                        foregroundColor,
1742:
1743:                        "TextField.inactiveBackground",
1744:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1745:                                JTextField.class, this .getDisabledTheme()),
1746:
1747:                        "TextField.inactiveForeground",
1748:                        disabledForegroundColor,
1749:
1750:                        "TextField.selectionBackground",
1751:                        selectionBackgroundColor,
1752:
1753:                        "TextField.selectionForeground",
1754:                        selectionForegroundColor,
1755:
1756:                        "TextPane.background",
1757:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1758:                                JTextPane.class, this ),
1759:
1760:                        "TextPane.border",
1761:                        textBorder,
1762:
1763:                        "TextPane.disabledBackground",
1764:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1765:                                JTextPane.class, this .getDisabledTheme()),
1766:
1767:                        "TextPane.foreground",
1768:                        foregroundColor,
1769:
1770:                        "TextPane.caretForeground",
1771:                        foregroundColor,
1772:
1773:                        "TextPane.inactiveBackground",
1774:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1775:                                JTextPane.class, this .getDisabledTheme()),
1776:
1777:                        "TextPane.inactiveForeground",
1778:                        disabledForegroundColor,
1779:
1780:                        "TextPane.selectionBackground",
1781:                        selectionBackgroundColor,
1782:
1783:                        "TextPane.selectionForeground",
1784:                        selectionForegroundColor,
1785:
1786:                        "TitledBorder.titleColor",
1787:                        foregroundColor,
1788:
1789:                        "TitledBorder.border",
1790:                        new SubstanceEtchedBorder(),
1791:
1792:                        "ToggleButton.foreground",
1793:                        foregroundColor,
1794:
1795:                        "ToggleButton.disabledText",
1796:                        disabledForegroundColor,
1797:
1798:                        "ToggleButton.margin",
1799:                        new InsetsUIResource(0, 0, 0, 0),
1800:
1801:                        "ToolBar.background",
1802:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1803:                                JToolBar.class, this ),
1804:
1805:                        "ToolBar.border",
1806:                        new BorderUIResource(new SubstanceToolBarBorder()),
1807:
1808:                        "ToolBar.isRollover",
1809:                        Boolean.TRUE,
1810:
1811:                        "ToolBar.foreground",
1812:                        foregroundColor,
1813:
1814:                        "ToolBarSeparator.background",
1815:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1816:                                JToolBar.class, this ),
1817:
1818:                        "ToolBarSeparator.foreground",
1819:                        lineBwColor,
1820:
1821:                        "ToolBar.separatorSize",
1822:                        null,
1823:
1824:                        "ToolTip.border",
1825:                        new UIDefaults.LazyValue() {
1826:                            public Object createValue(UIDefaults table) {
1827:                                return new LineBorder(foregroundColor);
1828:                            }
1829:                        },
1830:
1831:                        "ToolTip.borderInactive",
1832:                        regularMarginBorder,
1833:
1834:                        "ToolTip.background",
1835:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1836:                                JToolTip.class, this ),
1837:
1838:                        "ToolTip.backgroundInactive",
1839:                        new ColorUIResource(getDefaultColorScheme(this .kind)
1840:                                .getExtraLightColor()),
1841:
1842:                        "ToolTip.foreground",
1843:                        foregroundColor,
1844:
1845:                        "ToolTip.foregroundInactive",
1846:                        disabledForegroundColor,
1847:
1848:                        "Tree.closedIcon",
1849:                        emptyIcon,
1850:
1851:                        "Tree.collapsedIcon",
1852:                        new UIDefaults.LazyValue() {
1853:                            public Object createValue(UIDefaults table) {
1854:                                return new IconUIResource(SubstanceIconFactory
1855:                                        .getTreeIcon(null, true));
1856:                            }
1857:                        },
1858:
1859:                        "Tree.expandedIcon",
1860:                        new UIDefaults.LazyValue() {
1861:                            public Object createValue(UIDefaults table) {
1862:                                return new IconUIResource(SubstanceIconFactory
1863:                                        .getTreeIcon(null, false));
1864:                            }
1865:                        },
1866:
1867:                        "Tree.leafIcon",
1868:                        emptyIcon,
1869:
1870:                        "Tree.openIcon",
1871:                        emptyIcon,
1872:
1873:                        "Tree.background",
1874:                        SubstanceCoreUtilities.getDefaultBackgroundColor(
1875:                                JTree.class, this ),
1876:
1877:                        "Tree.selectionBackground", backgroundLightColor,
1878:
1879:                        "Tree.foreground", foregroundColor,
1880:
1881:                        "Tree.hash", lineColorDefault,
1882:
1883:                        "Tree.rowHeight", new Integer(0),
1884:
1885:                        "Tree.selectionBorderColor", lineColor,
1886:
1887:                        "Tree.selectionForeground",
1888:                        selectionCellForegroundColor,
1889:
1890:                        "Tree.textBackground", backgroundColor,
1891:
1892:                        "Tree.textForeground", foregroundColor,
1893:
1894:                        "Viewport.background", backgroundColor,
1895:
1896:                        "Viewport.foreground", foregroundColor,
1897:
1898:                };
1899:                table.putDefaults(defaults);
1900:            }
1901:
1902:            /**
1903:             * Returns the foreground color for this theme.
1904:             * 
1905:             * @return The foreground color for this theme.
1906:             * 
1907:             * @since version 4.0
1908:             */
1909:            public ColorUIResource getForegroundColor() {
1910:                return new ColorUIResource(SubstanceColorUtilities
1911:                        .getForegroundColor(this ));
1912:            }
1913:
1914:            /**
1915:             * Returns the foreground color for selected cells for this theme.
1916:             * 
1917:             * @return The foreground color for selected cells for this theme.
1918:             * 
1919:             * @since version 4.0
1920:             */
1921:            public Color getSelectionCellForegroundColor() {
1922:                return SubstanceColorUtilities.getForegroundColor(this 
1923:                        .getHighlightTheme(null, ComponentState.SELECTED));
1924:            }
1925:
1926:            /**
1927:             * Returns the selection foreground color for this theme.
1928:             * 
1929:             * @return The selection foreground color for this theme.
1930:             * 
1931:             * @since version 4.0
1932:             */
1933:            public Color getSelectionForegroundColor() {
1934:                return SubstanceColorUtilities
1935:                        .getSelectionForegroundColor(this );
1936:            }
1937:
1938:            /**
1939:             * Returns the selection background color for this theme.
1940:             * 
1941:             * @return The selection background color for this theme.
1942:             * 
1943:             * @since version 4.0
1944:             */
1945:            public Color getSelectionBackgroundColor() {
1946:                return SubstanceColorUtilities
1947:                        .getSelectionBackgroundColor(this );
1948:            }
1949:
1950:            /**
1951:             * Returns the line color for this theme.
1952:             * 
1953:             * @return The line color for this theme.
1954:             * 
1955:             * @since version 4.0
1956:             */
1957:            public Color getLineColor() {
1958:                return SubstanceColorUtilities.getLineColor(this );
1959:            }
1960:
1961:            /**
1962:             * Returns the line color for this theme.
1963:             * 
1964:             * @return The line color for this theme.
1965:             * 
1966:             * @since version 4.0
1967:             */
1968:            public Color getLineColorDefault() {
1969:                return SubstanceColorUtilities.getLineColor(this 
1970:                        .getDefaultTheme());
1971:            }
1972:
1973:            /**
1974:             * Returns the disabled background color for this theme.
1975:             * 
1976:             * @return The disabled background color for this theme.
1977:             * 
1978:             * @since version 4.0
1979:             * @deprecated Will be removed in version 5.0. Use
1980:             *             {@link #getDisabledTheme()} and
1981:             *             {@link SubstanceTheme#getBackgroundColor()}.
1982:             */
1983:            @Deprecated
1984:            public Color getDisabledBackgroundColor() {
1985:                return SubstanceColorUtilities.getInterpolatedColor(this 
1986:                        .getBackgroundColor(), this .getLightBackgroundColor(),
1987:                        0.5);
1988:            }
1989:
1990:            /**
1991:             * Returns the disabled foreground color for this theme.
1992:             * 
1993:             * @return The disabled foreground color for this theme.
1994:             * 
1995:             * @since version 4.0
1996:             * @deprecated Will be removed in version 5.0. Use
1997:             *             {@link #getDisabledTheme()} and
1998:             *             {@link SubstanceTheme#getForegroundColor()}.
1999:             */
2000:            @Deprecated
2001:            public Color getDisabledForegroundColor() {
2002:                return SubstanceColorUtilities.getDisabledForegroundColor(this );
2003:            }
2004:
2005:            /**
2006:             * Returns the light background color for this theme.
2007:             * 
2008:             * @return The light background color for this theme.
2009:             * 
2010:             * @since version 4.0
2011:             */
2012:            public Color getLightBackgroundColor() {
2013:                return SubstanceColorUtilities.getInterpolatedColor(
2014:                        getDefaultColorScheme().getUltraLightColor(),
2015:                        getDefaultColorScheme().getExtraLightColor(), 0.8);
2016:            }
2017:
2018:            /**
2019:             * Returns the background color for this theme.
2020:             * 
2021:             * @return The background color for this theme.
2022:             * 
2023:             * @since version 4.0
2024:             */
2025:            public Color getBackgroundColor() {
2026:                return SubstanceColorUtilities.getBackgroundColor(this );
2027:            }
2028:
2029:            /**
2030:             * Returns the kind of <code>this</code> theme. This method is part of
2031:             * officially supported API.
2032:             * 
2033:             * @return The kind of <code>this</code> theme.
2034:             */
2035:            public ThemeKind getKind() {
2036:                return this .kind;
2037:            }
2038:
2039:            /**
2040:             * Returns the default scheme that corresponds to the specified theme kind.
2041:             * This method is <b>for internal use only</b>.
2042:             * 
2043:             * @param themeKind
2044:             *            Theme kind.
2045:             * @return Default scheme that corresponds to the specified theme kind.
2046:             */
2047:            public static ColorScheme getDefaultColorScheme(ThemeKind themeKind) {
2048:                if (themeKind == ThemeKind.DARK)
2049:                    return DARK_METALLIC_SCHEME;
2050:                if (themeKind == ThemeKind.INVERTED)
2051:                    return INVERTED_LIGHT_GRAY_SCHEME;
2052:                if (themeKind == ThemeKind.NEGATED)
2053:                    return NEGATED_LIGHT_GRAY_SCHEME;
2054:                return METALLIC_SCHEME;
2055:            }
2056:
2057:            /**
2058:             * Returns the default theme that corresponds to the specified theme kind.
2059:             * This method is <b>for internal use only</b>.
2060:             * 
2061:             * @param themeKind
2062:             *            Theme kind.
2063:             * @return Default theme that corresponds to the specified theme kind.
2064:             */
2065:            private static SubstanceTheme getDefaultTheme(ThemeKind themeKind) {
2066:                if (themeKind == ThemeKind.DARK)
2067:                    return DARK_METALLIC;
2068:                if (themeKind == ThemeKind.INVERTED)
2069:                    return INVERTED_LIGHT_GRAY;
2070:                if (themeKind == ThemeKind.NEGATED)
2071:                    return NEGATED_LIGHT_GRAY;
2072:                return METALLIC;
2073:            }
2074:
2075:            /**
2076:             * Returns the disabled scheme that corresponds to the specified theme kind.
2077:             * This method is <b>for internal use only</b>.
2078:             * 
2079:             * @param themeKind
2080:             *            Theme kind.
2081:             * @return Disabled scheme that corresponds to the specified theme kind.
2082:             */
2083:            public static ColorScheme getDisabledColorScheme(ThemeKind themeKind) {
2084:                if (themeKind == ThemeKind.DARK)
2085:                    return DARK_GRAY_SCHEME;
2086:                if (themeKind == ThemeKind.INVERTED)
2087:                    return INVERTED_METALLIC_SCHEME;
2088:                if (themeKind == ThemeKind.NEGATED)
2089:                    return NEGATED_METALLIC_SCHEME;
2090:                return LIGHT_GRAY_SCHEME;
2091:            }
2092:
2093:            /**
2094:             * Returns the disabled theme that corresponds to the specified theme kind.
2095:             * This method is <b>for internal use only</b>.
2096:             * 
2097:             * @param themeKind
2098:             *            Theme kind.
2099:             * @return Disabled theme that corresponds to the specified theme kind.
2100:             */
2101:            private static SubstanceTheme getDisabledTheme(ThemeKind themeKind) {
2102:                if (themeKind == ThemeKind.DARK)
2103:                    return DARK_GRAY;
2104:                if (themeKind == ThemeKind.INVERTED)
2105:                    return INVERTED_METALLIC;
2106:                if (themeKind == ThemeKind.NEGATED)
2107:                    return NEGATED_METALLIC;
2108:                return LIGHT_GRAY;
2109:            }
2110:
2111:            /*
2112:             * (non-Javadoc)
2113:             * 
2114:             * @see org.jvnet.substance.utils.SubstanceTrait#getDisplayName()
2115:             */
2116:            public String getDisplayName() {
2117:                return this .displayName;
2118:            }
2119:
2120:            /**
2121:             * Returns the theme that matches the specified display name. This method is
2122:             * <b>for internal use only</b>.
2123:             * 
2124:             * @param displayName
2125:             *            Theme display name.
2126:             * @return Theme that matches the specified display name.
2127:             */
2128:            public static SubstanceTheme getTheme(String displayName) {
2129:                // SubstanceTheme result = allThemes.get(displayName);
2130:                // if (result != null)
2131:                // return result;
2132:                //
2133:                // try fetching from the available themes
2134:                ThemeInfo themeInfo = SubstanceLookAndFeel.getAllThemes().get(
2135:                        displayName);
2136:                if (themeInfo != null)
2137:                    return SubstanceTheme.createInstance(themeInfo);
2138:
2139:                throw new IllegalStateException("Theme with display name '"
2140:                        + displayName + "' can not be found");
2141:            }
2142:
2143:            /**
2144:             * Returns the default color scheme that corresponds to <code>this</code>
2145:             * theme. This method is <b>for internal use only</b>.
2146:             * 
2147:             * @return The default color scheme that corresponds to <code>this</code>
2148:             *         theme.
2149:             */
2150:            public ColorScheme getDefaultColorScheme() {
2151:                return this .getDefaultTheme().getColorScheme();
2152:            }
2153:
2154:            /**
2155:             * Returns the disabled color scheme that corresponds to <code>this</code>
2156:             * theme. This method is <b>for internal use only</b>.
2157:             * 
2158:             * @return The disabled color scheme that corresponds to <code>this</code>
2159:             *         theme.
2160:             */
2161:            public ColorScheme getDisabledColorScheme() {
2162:                return this .getDisabledTheme().getColorScheme();
2163:            }
2164:
2165:            /**
2166:             * Returns the theme that corresponds to the specified component state.
2167:             * 
2168:             * @param componentState
2169:             *            Component state.
2170:             * @return The theme that corresponds to the specified component state.
2171:             * 
2172:             * @since version 4.0
2173:             */
2174:            public SubstanceTheme getTheme(Component comp,
2175:                    ComponentState componentState) {
2176:                return this .getTheme(comp, componentState, false);
2177:            }
2178:
2179:            public SubstanceTheme getTheme(Component comp,
2180:                    ComponentState componentState, boolean toIgnoreHighlights) {
2181:                if (componentState.isKindActive(FadeKind.PRESS)) {
2182:                    if (this .pressedTheme == null) {
2183:                        this .pressedTheme = this .getActiveTheme().shade(0.2)
2184:                                .saturate(0.1);
2185:                    }
2186:                    return this .pressedTheme;
2187:                }
2188:                if (componentState == ComponentState.DISABLED_SELECTED) {
2189:                    if (this .disabledSelectedTheme == null) {
2190:                        this .disabledSelectedTheme = new SubstanceBlendBiTheme(
2191:                                this .getActiveTheme(), this .getDisabledTheme(),
2192:                                0.25);
2193:                    }
2194:                    return this .disabledSelectedTheme;
2195:                }
2196:
2197:                switch (componentState.getColorSchemeKind()) {
2198:                case CURRENT:
2199:                    return this .getActiveTheme();
2200:                case REGULAR:
2201:                    return this .getDefaultTheme();
2202:                case DISABLED:
2203:                    return this .getDisabledTheme();
2204:                }
2205:                return this ;
2206:            }
2207:
2208:            /**
2209:             * Returns the highlight theme that corresponds to the specified component
2210:             * state.
2211:             * 
2212:             * @param comp
2213:             *            Component.
2214:             * @param componentState
2215:             *            Component state.
2216:             * @return The highlight theme that corresponds to the specified component
2217:             *         state.
2218:             * 
2219:             * @since version 4.0
2220:             */
2221:            public SubstanceTheme getHighlightTheme(Component comp,
2222:                    ComponentState componentState) {
2223:                switch (componentState.getColorSchemeKind()) {
2224:                case CURRENT:
2225:                    return this .getActiveTheme();
2226:                case REGULAR:
2227:                    return this .getDefaultTheme();
2228:                case DISABLED:
2229:                    return this .getDisabledTheme();
2230:                }
2231:                return this ;
2232:            }
2233:
2234:            /**
2235:             * Returns the alpha channel that is applied on highlight theme when a
2236:             * component is in the specified state.
2237:             * 
2238:             * @param comp
2239:             *            Component.
2240:             * @param componentState
2241:             *            Component state.
2242:             * @return Alpha channel that is applied on highlight theme when a component
2243:             *         is in the specified state.
2244:             */
2245:            public float getHighlightThemeAlpha(Component comp,
2246:                    ComponentState componentState) {
2247:                boolean isRollover = componentState
2248:                        .isKindActive(FadeKind.ROLLOVER);
2249:                boolean isSelected = componentState
2250:                        .isKindActive(FadeKind.SELECTION);
2251:                boolean isArmed = componentState.isKindActive(FadeKind.ARM);
2252:
2253:                if (isRollover && isSelected)
2254:                    return 0.9f;
2255:                if (isRollover && isArmed)
2256:                    return 0.8f;
2257:                if (isSelected)
2258:                    return 0.7f;
2259:                if (isArmed)
2260:                    return 0.6f;
2261:                if (isRollover)
2262:                    return 0.4f;
2263:                return 0.0f;
2264:            }
2265:
2266:            /**
2267:             * Returns the alpha channel that is applied on theme when a component is in
2268:             * the specified state.
2269:             * 
2270:             * @param comp
2271:             *            Component.
2272:             * @param componentState
2273:             *            Component state.
2274:             * @return Alpha channel that is applied on theme when a component is in the
2275:             *         specified state.
2276:             */
2277:            public float getThemeAlpha(Component comp,
2278:                    ComponentState componentState) {
2279:                return 1.0f;
2280:            }
2281:
2282:            /**
2283:             * Returns the active theme that corresponds to <code>this</code> theme.
2284:             * This method is <b>for internal use only</b>.
2285:             * 
2286:             * @return The active theme that corresponds to <code>this</code> theme.
2287:             */
2288:            public SubstanceTheme getActiveTheme() {
2289:                return this ;
2290:            }
2291:
2292:            /**
2293:             * Returns the default theme that corresponds to <code>this</code> theme.
2294:             * This method is <b>for internal use only</b>.
2295:             * 
2296:             * @return The default theme that corresponds to <code>this</code> theme.
2297:             */
2298:            public SubstanceTheme getDefaultTheme() {
2299:                // if (this.kind == ThemeKind.MIXED)
2300:                // return getDefaultTheme(((SubstanceMixBiTheme) this)
2301:                // .getOriginalFirstTheme().getKind());
2302:                return getDefaultTheme(this .kind);
2303:            }
2304:
2305:            /**
2306:             * Returns the disabled theme that corresponds to <code>this</code> theme.
2307:             * This method is <b>for internal use only</b>.
2308:             * 
2309:             * @return The disabled theme that corresponds to <code>this</code> theme.
2310:             */
2311:            public SubstanceTheme getDisabledTheme() {
2312:                // if (this.kind == ThemeKind.MIXED)
2313:                // return getDisabledTheme(((SubstanceMixBiTheme) this)
2314:                // .getOriginalFirstTheme().getKind());
2315:                return getDisabledTheme(this .kind);
2316:            }
2317:
2318:            /**
2319:             * Returns indication whether <code>this</code> theme is dark. This method
2320:             * is part of officially supported API.
2321:             * 
2322:             * @return <code>true</code> if <code>this</code> theme is dark,
2323:             *         <code>false</code> otherwise.
2324:             * @deprecated Use {@link #getKind()} instead.
2325:             */
2326:            @Deprecated
2327:            public boolean isDark() {
2328:                return SubstanceCoreUtilities.isThemeDark(this );
2329:            }
2330:
2331:            /**
2332:             * Creates a new theme based on the specified parameters. Note that the
2333:             * preferred way is to create a plugin. This method is part of officially
2334:             * supported API.
2335:             * 
2336:             * @param scheme
2337:             *            Color scheme object.
2338:             * @param themeKind
2339:             *            Theme kind.
2340:             * @param displayName
2341:             *            Display name for the new theme.
2342:             * @return New theme object.
2343:             * @deprecated since 3.1 Use
2344:             *             {@link SubstanceTheme#SubstanceTheme(ColorScheme, String, org.jvnet.substance.theme.SubstanceTheme.ThemeKind)}
2345:             *             constructor instead.
2346:             */
2347:            @Deprecated
2348:            public static SubstanceTheme addUserDefined(ColorScheme scheme,
2349:                    ThemeKind themeKind, String displayName) {
2350:                SubstanceTheme userTheme = new SubstanceTheme(scheme,
2351:                        displayName, themeKind);
2352:                return userTheme;
2353:            }
2354:
2355:            // /**
2356:            // * Returns the translucent dark color of <code>this</code> theme.
2357:            // * This method is <b>for internal use only</b>.
2358:            // *
2359:            // * @param alpha
2360:            // * Alpha channel value.
2361:            // * @return Translucent dark color of <code>this</code> theme.
2362:            // */
2363:            // public Color getDarkColor(int alpha) {
2364:            // return new Color(this.getColorScheme().getDarkColor().getRed(), this
2365:            // .getColorScheme().getDarkColor().getGreen(), this
2366:            // .getColorScheme().getDarkColor().getBlue(), alpha);
2367:            //
2368:            // }
2369:            //
2370:            // /**
2371:            // * Returns the translucent ultra dark color of <code>this</code> theme.
2372:            // * This method is <b>for internal use only</b>.
2373:            // *
2374:            // * @param alpha
2375:            // * Alpha channel value.
2376:            // * @return Translucent ultra dark color of <code>this</code> theme.
2377:            // */
2378:            // public Color getUltraDarkColor(int alpha) {
2379:            // return new Color(this.getColorScheme().getUltraDarkColor().getRed(), this
2380:            // .getColorScheme().getUltraDarkColor().getGreen(), this
2381:            // .getColorScheme().getUltraDarkColor().getBlue(), alpha);
2382:            //
2383:            // }
2384:            //
2385:            // /**
2386:            // * Returns the translucent mid color of <code>this</code> theme.
2387:            // * This method is <b>for internal use only</b>.
2388:            // *
2389:            // * @param alpha
2390:            // * Alpha channel value.
2391:            // * @return Translucent mid color of <code>this</code> theme.
2392:            // */
2393:            // public Color getMidColor(int alpha) {
2394:            // return new Color(this.getColorScheme().getMidColor().getRed(), this
2395:            // .getColorScheme().getMidColor().getGreen(), this
2396:            // .getColorScheme().getMidColor().getBlue(), alpha);
2397:            //
2398:            // }
2399:            //
2400:            // /**
2401:            // * Returns the translucent ultra light color of <code>this</code> theme.
2402:            // * This method is <b>for internal use only</b>.
2403:            // *
2404:            // * @param alpha
2405:            // * Alpha channel value.
2406:            // * @return Translucent ultra light color of <code>this</code> theme.
2407:            // */
2408:            // public Color getUltraLightColor(int alpha) {
2409:            // return new Color(this.getColorScheme().getUltraLightColor().getRed(),
2410:            // this.getColorScheme().getUltraLightColor().getGreen(), this
2411:            // .getColorScheme().getUltraLightColor().getBlue(), alpha);
2412:            //
2413:            // }
2414:            //
2415:            // /**
2416:            // * Returns the translucent light color of <code>this</code> theme.
2417:            // * This method is <b>for internal use only</b>.
2418:            // *
2419:            // * @param alpha
2420:            // * Alpha channel value.
2421:            // * @return Translucent light color of <code>this</code> theme.
2422:            // */
2423:            // public Color getLightColor(int alpha) {
2424:            // return new Color(this.getColorScheme().getLightColor().getRed(),
2425:            // this.getColorScheme().getLightColor().getGreen(), this
2426:            // .getColorScheme().getLightColor().getBlue(), alpha);
2427:            //
2428:            // }
2429:            //
2430:            /**
2431:             * Returns the translucent watermark stamp color of <code>this</code>
2432:             * theme. This method is <b>for internal use only</b>.
2433:             * 
2434:             * @return Translucent watermark stamp color of <code>this</code> theme.
2435:             */
2436:            public Color getWatermarkStampColor() {
2437:                return SubstanceCoreUtilities.isThemeDark(this ) ? SubstanceColorUtilities
2438:                        .getAlphaColor(this .getColorScheme()
2439:                                .getUltraLightColor(), 30)
2440:                        /*
2441:                         * this .getUltraLightColor(30)
2442:                         */: SubstanceColorUtilities.getAlphaColor(this 
2443:                                .getColorScheme().getMidColor(), 50);
2444:                // this.getMidColor(50));
2445:            }
2446:
2447:            /**
2448:             * Creates a theme instance based on the specified theme info object. This
2449:             * method is <b>for internal use only</b>.
2450:             * 
2451:             * @param themeInfo
2452:             *            Theme info.
2453:             * @return Theme instance that matches the specified theme info object.
2454:             */
2455:            public static SubstanceTheme createInstance(ThemeInfo themeInfo) {
2456:                ThemeKind themeKind = themeInfo.getThemeKind();
2457:                if (themeKind == ThemeKind.MIXED) {
2458:                    try {
2459:                        MixedThemeInfo mixedThemeInfo = (MixedThemeInfo) themeInfo;
2460:                        String[] themeClassNames = mixedThemeInfo
2461:                                .getThemeClassNames();
2462:                        SubstanceTheme[] themeInstances = new SubstanceTheme[themeClassNames.length];
2463:                        for (int i = 0; i < themeClassNames.length; i++) {
2464:                            Class<?> themeClass = Class
2465:                                    .forName(themeClassNames[i]);
2466:                            if (themeClass == null) {
2467:                                return null;
2468:                            }
2469:                            Object obj = themeClass.newInstance();
2470:                            if (obj == null) {
2471:                                return null;
2472:                            }
2473:                            if (!(obj instanceof  SubstanceTheme)) {
2474:                                return null;
2475:                            }
2476:                            themeInstances[i] = (SubstanceTheme) obj;
2477:                        }
2478:
2479:                        SubstanceTheme mixedTheme = new SubstanceMixTheme(
2480:                                themeInstances);
2481:
2482:                        return mixedTheme;
2483:                    } catch (Exception exc) {
2484:                        return null;
2485:                    }
2486:                }
2487:                if (themeKind == ThemeKind.INVERTED) {
2488:                    try {
2489:                        Class<?> themeClass = Class.forName(themeInfo
2490:                                .getClassName());
2491:                        if (themeClass == null) {
2492:                            return null;
2493:                        }
2494:                        Object obj = themeClass.newInstance();
2495:                        if (obj == null) {
2496:                            return null;
2497:                        }
2498:                        if (!(obj instanceof  SubstanceTheme)) {
2499:                            return null;
2500:                        }
2501:                        SubstanceTheme origTheme = (SubstanceTheme) obj;
2502:                        SubstanceTheme invertedTheme = new SubstanceInvertedTheme(
2503:                                origTheme);
2504:                        return invertedTheme;
2505:                    } catch (Exception exc) {
2506:                        return null;
2507:                    }
2508:                }
2509:
2510:                if (themeKind == ThemeKind.NEGATED) {
2511:                    try {
2512:                        Class<?> themeClass = Class.forName(themeInfo
2513:                                .getClassName());
2514:                        if (themeClass == null) {
2515:                            return null;
2516:                        }
2517:                        Object obj = themeClass.newInstance();
2518:                        if (obj == null) {
2519:                            return null;
2520:                        }
2521:                        if (!(obj instanceof  SubstanceTheme)) {
2522:                            return null;
2523:                        }
2524:                        SubstanceTheme origTheme = (SubstanceTheme) obj;
2525:                        SubstanceTheme negatedTheme = new SubstanceNegatedTheme(
2526:                                origTheme);
2527:                        return negatedTheme;
2528:                    } catch (Exception exc) {
2529:                        return null;
2530:                    }
2531:                }
2532:
2533:                try {
2534:                    Class<?> themeClass = Class.forName(themeInfo
2535:                            .getClassName());
2536:                    if (themeClass == null) {
2537:                        return null;
2538:                    }
2539:                    Object obj = themeClass.newInstance();
2540:                    if (obj == null) {
2541:                        return null;
2542:                    }
2543:                    if (!(obj instanceof  SubstanceTheme)) {
2544:                        return null;
2545:                    }
2546:                    return (SubstanceTheme) obj;
2547:                } catch (Exception exc) {
2548:                    return null;
2549:                }
2550:            }
2551:
2552:            /**
2553:             * Creates a shift version of <code>this</code> theme. This method is part
2554:             * of officially supported API.
2555:             * 
2556:             * @param backgroundShiftColor
2557:             *            Shift color for background colors. Should have full opacity.
2558:             * @param backgroundShiftFactor
2559:             *            Value in 0.0...1.0 range. Larger values shift more towards the
2560:             *            specified color.
2561:             * @param foregroundShiftColor
2562:             *            Shift color for foreground colors. Should have full opacity.
2563:             * @param foregroundShiftFactor
2564:             *            Value in 0.0...1.0 range. Larger values shift more towards the
2565:             *            specified color.
2566:             * @return Shift version of <code>this</code> theme.
2567:             */
2568:            public SubstanceTheme shift(Color backgroundShiftColor,
2569:                    double backgroundShiftFactor, Color foregroundShiftColor,
2570:                    double foregroundShiftFactor) {
2571:                return new SubstanceShiftTheme(this , backgroundShiftColor,
2572:                        backgroundShiftFactor, foregroundShiftColor,
2573:                        foregroundShiftFactor);
2574:            }
2575:
2576:            /**
2577:             * Creates a tinted (shifted towards white) version of <code>this</code>
2578:             * theme. This method is part of officially supported API.
2579:             * 
2580:             * @param tintFactor
2581:             *            Value in 0.0...1.0 range. Larger values shift more towards
2582:             *            white color.
2583:             * @return Tinted version of <code>this</code> theme.
2584:             */
2585:            public SubstanceTheme tint(double tintFactor) {
2586:                return new SubstanceTintTheme(this , tintFactor);
2587:            }
2588:
2589:            /**
2590:             * Creates a toned (shifted towards gray) version of <code>this</code>
2591:             * theme. This method is part of officially supported API.
2592:             * 
2593:             * @param toneFactor
2594:             *            Value in 0.0...1.0 range. Larger values shift more towards
2595:             *            gray color.
2596:             * @return Toned version of <code>this</code> theme.
2597:             */
2598:            public SubstanceTheme tone(double toneFactor) {
2599:                return new SubstanceToneTheme(this , toneFactor);
2600:            }
2601:
2602:            /**
2603:             * Creates a shaded (shifted towards black) version of <code>this</code>
2604:             * theme. This method is part of officially supported API.
2605:             * 
2606:             * @param shadeFactor
2607:             *            Value in 0.0...1.0 range. Larger values shift more towards
2608:             *            black color.
2609:             * @return Shaded version of <code>this</code> theme.
2610:             */
2611:            public SubstanceTheme shade(double shadeFactor) {
2612:                return new SubstanceShadeTheme(this , shadeFactor);
2613:            }
2614:
2615:            /**
2616:             * Creates a saturated or desaturated version of <code>this</code> theme.
2617:             * The value and brightness stay the same. This method is part of officially
2618:             * supported API.
2619:             * 
2620:             * @param saturateFactor
2621:             *            Value in -1.0...1.0 range. Positive values create more
2622:             *            saturated colors. Negative values create more desaturated
2623:             *            colors.
2624:             * @return Saturated version of <code>this</code> theme.
2625:             */
2626:            public SubstanceTheme saturate(double saturateFactor) {
2627:                return this .saturate(saturateFactor, true);
2628:            }
2629:
2630:            /**
2631:             * Creates a saturated or desaturated version of <code>this</code> theme.
2632:             * The value and brightness stay the same. This method is part of officially
2633:             * supported API.
2634:             * 
2635:             * @param saturateFactor
2636:             *            Value in -1.0...1.0 range. Positive values create more
2637:             *            saturated colors. Negative values create more desaturated
2638:             *            colors.
2639:             * @param toSaturateEverything
2640:             *            If <code>true</code>, all visual components of
2641:             *            <code>this</code> theme will be saturated. If
2642:             *            <code>false</code>, only the {@link #getActiveTheme()} will
2643:             *            be saturated.
2644:             * @return Saturated version of <code>this</code> theme.
2645:             */
2646:            public SubstanceTheme saturate(double saturateFactor,
2647:                    boolean toSaturateEverything) {
2648:                return new SubstanceSaturatedTheme(this , saturateFactor,
2649:                        toSaturateEverything);
2650:            }
2651:
2652:            /**
2653:             * Creates an inverted version of <code>this</code> theme. This method is
2654:             * part of officially supported API.
2655:             * 
2656:             * @return Inverted version of <code>this</code> theme.
2657:             */
2658:            public SubstanceTheme invert() {
2659:                return new SubstanceInvertedTheme(this );
2660:            }
2661:
2662:            /**
2663:             * Creates a negated version of <code>this</code> theme. This method is
2664:             * part of officially supported API.
2665:             * 
2666:             * @return Negated version of <code>this</code> theme.
2667:             */
2668:            public SubstanceTheme negate() {
2669:                return new SubstanceNegatedTheme(this );
2670:            }
2671:
2672:            /**
2673:             * Creates a hue-shifted (in HSB space) version of <code>this</code>
2674:             * theme. This method is part of officially supported API.
2675:             * 
2676:             * @param hueShiftFactor
2677:             *            Value in -1.0...1.0 range.
2678:             * @return Hue-shifted version of <code>this</code> theme.
2679:             */
2680:            public SubstanceTheme hueShift(double hueShiftFactor) {
2681:                return new SubstanceHueShiftTheme(this , hueShiftFactor);
2682:            }
2683:
2684:            /**
2685:             * Creates a new version of <code>this</code> theme that simulates the
2686:             * <code>protanopia</code> color blindness.
2687:             * 
2688:             * @return New version of <code>this</code> theme that simulates the
2689:             *         <code>protanopia</code> color blindness.
2690:             */
2691:            public SubstanceTheme protanopia() {
2692:                return new SubstanceProtanopiaTheme(this );
2693:            }
2694:
2695:            /**
2696:             * Creates a new version of <code>this</code> theme that simulates the
2697:             * <code>tritanopia</code> color blindness.
2698:             * 
2699:             * @return New version of <code>this</code> theme that simulates the
2700:             *         <code>tritanopia</code> color blindness.
2701:             */
2702:            public SubstanceTheme tritanopia() {
2703:                return new SubstanceTritanopiaTheme(this );
2704:            }
2705:
2706:            /**
2707:             * Creates a new version of <code>this</code> theme that simulates the
2708:             * <code>deuteranopia</code> color blindness.
2709:             * 
2710:             * @return New version of <code>this</code> theme that simulates the
2711:             *         <code>deuteranopia</code> color blindness.
2712:             */
2713:            public SubstanceTheme deuteranopia() {
2714:                return new SubstanceDeuteranopiaTheme(this );
2715:            }
2716:
2717:            /**
2718:             * Returns the theme for title panes of active frames. This method is <b>for
2719:             * internal use only</b>.
2720:             * 
2721:             * @return Theme for title panes of active frames
2722:             */
2723:            public SubstanceTheme getActiveTitlePaneTheme() {
2724:                return this ;
2725:            }
2726:
2727:            /**
2728:             * Returns the theme for title panes of inactive frames. This method is
2729:             * <b>for internal use only</b>.
2730:             * 
2731:             * @return Theme for title panes of inactive frames
2732:             */
2733:            public SubstanceTheme getDefaultTitlePaneTheme() {
2734:                return this ;
2735:            }
2736:
2737:            /**
2738:             * Returns the first theme. This method is <b>for internal use only</b>.
2739:             * 
2740:             * @return First theme.
2741:             */
2742:            public SubstanceTheme getFirstTheme() {
2743:                return this ;
2744:            }
2745:
2746:            /**
2747:             * Returns the second theme. This method is <b>for internal use only</b>.
2748:             * 
2749:             * @return Second theme.
2750:             */
2751:            public SubstanceTheme getSecondTheme() {
2752:                return this ;
2753:            }
2754:
2755:            /**
2756:             * Returns the theme for watermark painting.
2757:             * 
2758:             * @return Theme for watermark painting.
2759:             */
2760:            public SubstanceTheme getWatermarkTheme() {
2761:                if (SubstanceCoreUtilities.isThemeDark(this ))
2762:                    return this .getActiveTheme();
2763:                return this .getDefaultTheme();
2764:            }
2765:
2766:            /**
2767:             * Returns the theme for border painting.
2768:             * 
2769:             * @return Theme for border painting.
2770:             * @since version 4.0
2771:             */
2772:            public SubstanceTheme getBorderTheme() {
2773:                return this ;
2774:            }
2775:
2776:            // /**
2777:            // * Returns the theme for painting the highlight background of selected
2778:            // * elements, such as tree / table / list renderers, selections in text
2779:            // * controls and so on.
2780:            // *
2781:            // * @return Theme for painting the highlight background of selected
2782:            // elements,
2783:            // * such as tree / table / list renderers, selections in text
2784:            // * controls and so on.
2785:            // */
2786:            // public SubstanceTheme getHighlightBackgroundTheme() {
2787:            // return this.getActiveTheme();
2788:            // }
2789:            //
2790:            /**
2791:             * Returns the painter for painting the non-active controls.
2792:             * 
2793:             * @return Painter for painting the non-active controls.
2794:             */
2795:            public SubstanceGradientPainter getNonActivePainter() {
2796:                return new StandardGradientPainter();
2797:            }
2798:
2799:            /*
2800:             * (non-Javadoc)
2801:             * 
2802:             * @see java.lang.Object#toString()
2803:             */
2804:            @Override
2805:            public String toString() {
2806:                return this .getDisplayName();
2807:            }
2808:
2809:            //
2810:            // public boolean toPaintActive(Component component) {
2811:            // if (component == null)
2812:            // return false;
2813:            //
2814:            // Class<?> clazz = component.getClass();
2815:            // for (Class<?> registered : activeControls) {
2816:            // if (registered.isAssignableFrom(clazz))
2817:            // return true;
2818:            // }
2819:            // return false;
2820:            // }
2821:            //
2822:            // public void addPaintAsActive(Class clazz) {
2823:            // this.activeControls.add(clazz);
2824:            // }
2825:
2826:            /**
2827:             * Returns the start of fade effect on the selected tabs in
2828:             * {@link JTabbedPane}s. This value can be used to create XP-like "headers"
2829:             * on the selected tabs.
2830:             * 
2831:             * @return The start of fade effect on the selected tabs in
2832:             *         {@link JTabbedPane}s.
2833:             * @see #getSelectedTabFadeEnd()
2834:             */
2835:            public double getSelectedTabFadeStart() {
2836:                return 0.1;
2837:            }
2838:
2839:            /**
2840:             * Returns the end of fade effect on the selected tabs in
2841:             * {@link JTabbedPane}s. This value can be used to create XP-like "headers"
2842:             * on the selected tabs.
2843:             * 
2844:             * @return The end of fade effect on the selected tabs in
2845:             *         {@link JTabbedPane}s.
2846:             * @see #getSelectedTabFadeStart()
2847:             */
2848:            public double getSelectedTabFadeEnd() {
2849:                return 0.3;
2850:            }
2851:
2852:            public SubstanceTheme getDecorationTheme(
2853:                    DecorationAreaType decorationType) {
2854:                if (decorationType == DecorationAreaType.PRIMARY_TITLE_PANE
2855:                        || decorationType == DecorationAreaType.SECONDARY_TITLE_PANE)
2856:                    return this ;
2857:                return this .getDefaultTheme();
2858:            }
2859:
2860:            public boolean toUseDecorationPainter(
2861:                    DecorationAreaType decorationType) {
2862:                if (decorationType == DecorationAreaType.PRIMARY_TITLE_PANE
2863:                        || decorationType == DecorationAreaType.SECONDARY_TITLE_PANE)
2864:                    return true;
2865:                return false;
2866:            }
2867:
2868:            public boolean toUseDecorationThemeOnActiveControls(
2869:                    DecorationAreaType decorationType) {
2870:                return false;
2871:            }
2872:
2873:            public boolean isPaintingToolbarDropShadows() {
2874:                return false;
2875:            }
2876:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.