Source Code Cross Referenced for PlafOptions.java in  » Swing-Library » pgslookandfeel » com » pagosoft » plaf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » pgslookandfeel » com.pagosoft.plaf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Patrick Gotthardt
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package com.pagosoft.plaf;
017:
018:        import javax.swing.*;
019:        import javax.swing.plaf.metal.*;
020:        import java.awt.*;
021:        import java.util.HashMap;
022:
023:        public class PlafOptions {
024:            private static boolean vistaStyle;
025:
026:            private PlafOptions() {
027:            }
028:
029:            // --------------------------------------------------------
030:            // Global things
031:            public static void setAsLookAndFeel() {
032:                PgsLookAndFeel.setAsLookAndFeel();
033:            }
034:
035:            public static void setCurrentTheme(MetalTheme t) {
036:                PgsLookAndFeel.setCurrentTheme(t);
037:            }
038:
039:            public static void updateAllUIs() {
040:                PgsLookAndFeel.updateAllUIs();
041:            }
042:
043:            private static Dimension defIconSize = new Dimension(10, 10);
044:
045:            public static void setDefaultMenuItemIconSize(Dimension dim) {
046:                defIconSize = dim;
047:            }
048:
049:            public static Dimension getDefaultMenuItemIconSize() {
050:                return defIconSize;
051:            }
052:
053:            // --------------------------------------------------------
054:            // Narrows
055:            private static boolean useExtraMargin = true;
056:
057:            public static boolean useExtraMargin() {
058:                return useExtraMargin;
059:            }
060:
061:            public static void useExtraMargin(boolean use) {
062:                useExtraMargin = use;
063:            }
064:
065:            // --------------------------------------------------------
066:            // Use bold fonts?
067:            private static boolean useBoldFonts = false;
068:            private static boolean useBoldMenuFonts = true;
069:
070:            public static boolean useBoldFonts() {
071:                return useBoldFonts;
072:            }
073:
074:            public static void useBoldFonts(boolean use) {
075:                useBoldFonts = use;
076:                UIManager.put("swing.boldMetal", Boolean.valueOf(use));
077:            }
078:
079:            public static boolean useBoldMenuFonts() {
080:                return useBoldMenuFonts;
081:            }
082:
083:            public static void useBoldMenuFonts(boolean use) {
084:                useBoldMenuFonts = use;
085:            }
086:
087:            // --------------------------------------------------------
088:            // Component options
089:            private static boolean useShadowBorder = false;
090:
091:            public static void useShadowBorder(boolean use) {
092:                useShadowBorder = use;
093:            }
094:
095:            public static boolean isShadowBorderUsed() {
096:                return useShadowBorder;
097:            }
098:
099:            private static boolean useToolBarIcon = true;
100:
101:            public static void useToolBarIcon(boolean use) {
102:                useToolBarIcon = use;
103:            }
104:
105:            public static boolean isToolBarIconUsed() {
106:                return useToolBarIcon;
107:            }
108:
109:            private static boolean useDisabledIcon = true;
110:
111:            public static void useDisabledIcon(boolean use) {
112:                useDisabledIcon = use;
113:            }
114:
115:            public static boolean isDisabledIconUsed() {
116:                return useDisabledIcon;
117:            }
118:
119:            private static boolean aaText = false;
120:
121:            public static void setAntialiasingEnabled(boolean use) {
122:                aaText = use;
123:            }
124:
125:            public static boolean isAntialiasingEnabled() {
126:                return aaText;
127:            }
128:
129:            private static boolean isClearBorderEnabled = false;
130:
131:            public static void setClearBorderEnabled(boolean enabled) {
132:                PgsUtils.regenerateBorderStroke();
133:                isClearBorderEnabled = enabled;
134:            }
135:
136:            public static boolean isClearBorderEnabled() {
137:                return isClearBorderEnabled;
138:            }
139:
140:            private static boolean fixHtmlDisplay = true;
141:
142:            public static boolean isHtmlDisplayFixEnabled() {
143:                return fixHtmlDisplay;
144:            }
145:
146:            public static void setFixHtmlDisplayEnabled(
147:                    boolean aFixHtmlDisplayEnabled) {
148:                fixHtmlDisplay = aFixHtmlDisplayEnabled;
149:            }
150:
151:            private static boolean wheelTabbedPaneEnabled = true;
152:
153:            public static boolean isWheelTabbedPaneEnabled() {
154:                return wheelTabbedPaneEnabled;
155:            }
156:
157:            public static void setWheelTabbedPaneEnabled(boolean enabled) {
158:                wheelTabbedPaneEnabled = enabled;
159:            }
160:
161:            private static boolean tabbedPaneRightClickSelectionEnabled = false;
162:
163:            public static boolean isTabbedPaneRightClickSelectionEnabled() {
164:                return tabbedPaneRightClickSelectionEnabled;
165:            }
166:
167:            public static void setTabbedPaneRightClickSelectionEnabled(
168:                    boolean enabled) {
169:                tabbedPaneRightClickSelectionEnabled = enabled;
170:            }
171:
172:            private static boolean tabReorderingEnabled = false;
173:
174:            public static boolean isTabReorderingEnabled() {
175:                return tabReorderingEnabled;
176:            }
177:
178:            public static void setTabReorderingEnabled(boolean enabled) {
179:                tabReorderingEnabled = enabled;
180:            }
181:
182:            private static boolean paintRolloverButtonBorder = true;
183:
184:            public static boolean isPaintRolloverButtonBorder() {
185:                return paintRolloverButtonBorder;
186:            }
187:
188:            public static void setPaintRolloverButtonBorder(
189:                    boolean paintRolloverButtonBorder) {
190:                PlafOptions.paintRolloverButtonBorder = paintRolloverButtonBorder;
191:            }
192:
193:            private static boolean officeScrollBarEnabled = false;
194:
195:            public static boolean isOfficeScrollBarEnabled() {
196:                return officeScrollBarEnabled;
197:            }
198:
199:            public static void setOfficeScrollBarEnabled(
200:                    boolean officeScrollBarEnabled) {
201:                PlafOptions.officeScrollBarEnabled = officeScrollBarEnabled;
202:            }
203:
204:            // --------------------------------------------------------
205:            // Style
206:            public static final int FLAT_STYLE = 0;
207:            public static final int GRADIENT_STYLE = 1;
208:            private static int defStyle = GRADIENT_STYLE;
209:
210:            public static final String MENU_ITEM = "MenuItem";
211:            public static final String TOOLBAR = "ToolBar";
212:            public static final String BUTTON = "Button";
213:            public static final String TOOLBARBUTTON = "ToolBarButton";
214:            public static final String MENUBAR = "MenuBar";
215:            public static final String MENUBARMENU = "MenuBarMenu";
216:
217:            private static HashMap styles = new HashMap();
218:
219:            static {
220:                // Initialize some styles per default
221:                setStyle(MENU_ITEM, FLAT_STYLE);
222:                setStyle(MENUBAR, FLAT_STYLE);
223:                setStyle(MENUBARMENU, FLAT_STYLE);
224:
225:                setStyle(TOOLBAR, GRADIENT_STYLE);
226:                setStyle(TOOLBARBUTTON, GRADIENT_STYLE);
227:            }
228:
229:            public static void setDefaultStyle(int s) {
230:                if (s == FLAT_STYLE || s == GRADIENT_STYLE) {
231:                    defStyle = s;
232:                } else {
233:                    throw new IllegalArgumentException(
234:                            "The Style must be flat or gradient");
235:                }
236:            }
237:
238:            public static void setStyle(String key, int s) {
239:                if (s == FLAT_STYLE || s == GRADIENT_STYLE) {
240:                    styles.put(key, new Integer(s));
241:                } else {
242:                    throw new IllegalArgumentException(
243:                            "The Style must be flat or gradient");
244:                }
245:            }
246:
247:            public static int getStyle(String key) {
248:                if (styles.containsKey(key)) {
249:                    return ((Integer) styles.get(key)).intValue();
250:                }
251:                return defStyle;
252:            }
253:
254:            public static Boolean isFlat(String key) {
255:                return getStyle(key) == FLAT_STYLE ? Boolean.TRUE
256:                        : Boolean.FALSE;
257:            }
258:
259:            // Jide-stuff
260:            private static boolean fastGradient = false;
261:
262:            public static void enableJideFastGradient() {
263:                // verify usage of jidesoft's SwingUtilities
264:                com.jidesoft.utils.Lm.verifyLicense("Patrick Gotthardt",
265:                        "PgsLookAndFeel", "aW6dEcgCQMkW4e:OGYJCDdPATGYEiLo2");
266:
267:                fastGradient = true;
268:            }
269:
270:            public static boolean isJideFastGradientEnabled() {
271:                return fastGradient;
272:            }
273:
274:            public static boolean isVistaStyle() {
275:                return vistaStyle;
276:            }
277:
278:            public static void setVistaStyle(boolean vistaStyle) {
279:                PlafOptions.vistaStyle = vistaStyle;
280:            }
281:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.