Source Code Cross Referenced for FontResources.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » chameleon » skins » resources » 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 » 6.0 JDK Modules » j2me » com.sun.midp.chameleon.skins.resources 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package com.sun.midp.chameleon.skins.resources;
028:
029:        import javax.microedition.lcdui.Font;
030:
031:        /**
032:         * There are three different font faces available in MIDP:
033:         * Monospace, Proportional, and System. There are eight 
034:         * different styles available: Plain, Italic, Bold, Bold Italic,
035:         * Underline, Underline Italic, Underline Bold, and 
036:         * Underline Bold Italic. There are three different sizes 
037:         * available: Small, Medium, and Large. That presents
038:         * a matrix of 72 different font possibilities. This class
039:         * serves to manage those different possibilities.
040:         *
041:         * Identifiers use a FACE_STYLE_SIZE naming scheme, where
042:         * FACE is one of [MONO|PROP|SYS], STYLE is one of 
043:         * [P|I|B|BI|U|UI|UB|UBI], and SIZE is one of [S|M|L].
044:         */
045:        public class FontResources {
046:
047:            /**
048:             * IMPL_NOTE: font constants have been moved to 
049:             * FontResourcesConstants class. However, they are
050:             * duplicated here because this file is used by
051:             * skin authors to lookup for possible constants 
052:             * values. This should be changed in future releases.
053:             */
054:
055:            /** Monospaced, plain, small */
056:            public final static int MONO_P_S = FontResourcesConstants.MONO_P_S;
057:            /** Monospaced, italic, small */
058:            public final static int MONO_I_S = FontResourcesConstants.MONO_I_S;
059:            /** Monospaced, bold, small */
060:            public final static int MONO_B_S = FontResourcesConstants.MONO_B_S;
061:            /** Monospaced, bold italic, small */
062:            public final static int MONO_BI_S = FontResourcesConstants.MONO_BI_S;
063:            /** Monospaced, underline, small */
064:            public final static int MONO_U_S = FontResourcesConstants.MONO_U_S;
065:            /** Monospaced, underline italic, small */
066:            public final static int MONO_UI_S = FontResourcesConstants.MONO_UI_S;
067:            /** Monospaced, underline bold, small */
068:            public final static int MONO_UB_S = FontResourcesConstants.MONO_UB_S;
069:            /** Monospaced, underline bold italic, small */
070:            public final static int MONO_UBI_S = FontResourcesConstants.MONO_UBI_S;
071:
072:            /** Monospaced, plain, medium */
073:            public final static int MONO_P_M = FontResourcesConstants.MONO_P_M;
074:            /** Monospaced, italic, medium */
075:            public final static int MONO_I_M = FontResourcesConstants.MONO_I_M;
076:            /** Monospaced, bold, medium */
077:            public final static int MONO_B_M = FontResourcesConstants.MONO_B_M;
078:            /** Monospaced, bold italic, medium */
079:            public final static int MONO_BI_M = FontResourcesConstants.MONO_BI_M;
080:            /** Monospaced, underline, medium */
081:            public final static int MONO_U_M = FontResourcesConstants.MONO_U_M;
082:            /** Monospaced, underline italic, medium */
083:            public final static int MONO_UI_M = FontResourcesConstants.MONO_UI_M;
084:            /** Monospaced, underline bold, medium */
085:            public final static int MONO_UB_M = FontResourcesConstants.MONO_UB_M;
086:            /** Monospaced, underline bold italic, medium */
087:            public final static int MONO_UBI_M = FontResourcesConstants.MONO_UBI_M;
088:
089:            /** Monospaced, plain, large */
090:            public final static int MONO_P_L = FontResourcesConstants.MONO_P_L;
091:            /** Monospaced, italic, large */
092:            public final static int MONO_I_L = FontResourcesConstants.MONO_I_L;
093:            /** Monospaced, bold, large */
094:            public final static int MONO_B_L = FontResourcesConstants.MONO_B_L;
095:            /** Monospaced, bold italic, large */
096:            public final static int MONO_BI_L = FontResourcesConstants.MONO_BI_L;
097:            /** Monospaced, underline, large */
098:            public final static int MONO_U_L = FontResourcesConstants.MONO_U_L;
099:            /** Monospaced, underline italic, large */
100:            public final static int MONO_UI_L = FontResourcesConstants.MONO_UI_L;
101:            /** Monospaced, underline bold, large */
102:            public final static int MONO_UB_L = FontResourcesConstants.MONO_UB_L;
103:            /** Monospaced, underline bold italic, large */
104:            public final static int MONO_UBI_L = FontResourcesConstants.MONO_UBI_L;
105:
106:            /** Proportional, plain, small */
107:            public final static int PROP_P_S = FontResourcesConstants.PROP_P_S;
108:            /** Proportional, italic, small */
109:            public final static int PROP_I_S = FontResourcesConstants.PROP_I_S;
110:            /** Proportional, bold, small */
111:            public final static int PROP_B_S = FontResourcesConstants.PROP_B_S;
112:            /** Proportional, bold italic, small */
113:            public final static int PROP_BI_S = FontResourcesConstants.PROP_BI_S;
114:            /** Proportional, underline, small */
115:            public final static int PROP_U_S = FontResourcesConstants.PROP_U_S;
116:            /** Proportional, underline italic, small */
117:            public final static int PROP_UI_S = FontResourcesConstants.PROP_UI_S;
118:            /** Proportional, underline bold, small */
119:            public final static int PROP_UB_S = FontResourcesConstants.PROP_UB_S;
120:            /** Proportional, underline bold italic, small */
121:            public final static int PROP_UBI_S = FontResourcesConstants.PROP_UBI_S;
122:
123:            /** Proportional, plain, medium */
124:            public final static int PROP_P_M = FontResourcesConstants.PROP_P_M;
125:            /** Proportional, italic, medium */
126:            public final static int PROP_I_M = FontResourcesConstants.PROP_I_M;
127:            /** Proportional, bold, medium */
128:            public final static int PROP_B_M = FontResourcesConstants.PROP_B_M;
129:            /** Proportional, bold italic, medium */
130:            public final static int PROP_BI_M = FontResourcesConstants.PROP_BI_M;
131:            /** Proportional, underline, medium */
132:            public final static int PROP_U_M = FontResourcesConstants.PROP_U_M;
133:            /** Proportional, underline italic, medium */
134:            public final static int PROP_UI_M = FontResourcesConstants.PROP_UI_M;
135:            /** Proportional, underline bold, medium */
136:            public final static int PROP_UB_M = FontResourcesConstants.PROP_UB_M;
137:            /** Proportional, underline bold italic, medium */
138:            public final static int PROP_UBI_M = FontResourcesConstants.PROP_UBI_M;
139:
140:            /** Proportional, plain, large */
141:            public final static int PROP_P_L = FontResourcesConstants.PROP_P_L;
142:            /** Proportional, italic, large */
143:            public final static int PROP_I_L = FontResourcesConstants.PROP_I_L;
144:            /** Proportional, bold, large */
145:            public final static int PROP_B_L = FontResourcesConstants.PROP_B_L;
146:            /** Proportional, bold italic, large */
147:            public final static int PROP_BI_L = FontResourcesConstants.PROP_BI_L;
148:            /** Proportional, underline, large */
149:            public final static int PROP_U_L = FontResourcesConstants.PROP_U_L;
150:            /** Proportional, underline italic, large */
151:            public final static int PROP_UI_L = FontResourcesConstants.PROP_UI_L;
152:            /** Proportional, underline bold, large */
153:            public final static int PROP_UB_L = FontResourcesConstants.PROP_UB_L;
154:            /** Proportional, underline bold italic, large */
155:            public final static int PROP_UBI_L = FontResourcesConstants.PROP_UBI_L;
156:
157:            /** System, plain, small */
158:            public final static int SYS_P_S = FontResourcesConstants.SYS_P_S;
159:            /** System, italic, small */
160:            public final static int SYS_I_S = FontResourcesConstants.SYS_I_S;
161:            /** System, bold, small */
162:            public final static int SYS_B_S = FontResourcesConstants.SYS_B_S;
163:            /** System, bold italic, small */
164:            public final static int SYS_BI_S = FontResourcesConstants.SYS_BI_S;
165:            /** System, underline, small */
166:            public final static int SYS_U_S = FontResourcesConstants.SYS_U_S;
167:            /** System, underline italic, small */
168:            public final static int SYS_UI_S = FontResourcesConstants.SYS_UI_S;
169:            /** System, underline bold, small */
170:            public final static int SYS_UB_S = FontResourcesConstants.SYS_UB_S;
171:            /** System, underline bold italic, small */
172:            public final static int SYS_UBI_S = FontResourcesConstants.SYS_UBI_S;
173:
174:            /** System, plain, medium */
175:            public final static int SYS_P_M = FontResourcesConstants.SYS_P_M;
176:            /** System, italic, medium */
177:            public final static int SYS_I_M = FontResourcesConstants.SYS_I_M;
178:            /** System, bold, medium */
179:            public final static int SYS_B_M = FontResourcesConstants.SYS_B_M;
180:            /** System, bold italic, medium */
181:            public final static int SYS_BI_M = FontResourcesConstants.SYS_BI_M;
182:            /** System, underline, medium */
183:            public final static int SYS_U_M = FontResourcesConstants.SYS_U_M;
184:            /** System, underline italic, medium */
185:            public final static int SYS_UI_M = FontResourcesConstants.SYS_UI_M;
186:            /** System, underline bold, medium */
187:            public final static int SYS_UB_M = FontResourcesConstants.SYS_UB_M;
188:            /** System, underline bold italic, medium */
189:            public final static int SYS_UBI_M = FontResourcesConstants.SYS_UBI_M;
190:
191:            /** System, plain, large */
192:            public final static int SYS_P_L = FontResourcesConstants.SYS_P_L;
193:            /** System, italic, large */
194:            public final static int SYS_I_L = FontResourcesConstants.SYS_I_L;
195:            /** System, bold, large */
196:            public final static int SYS_B_L = FontResourcesConstants.SYS_B_L;
197:            /** System, bold italic, large */
198:            public final static int SYS_BI_L = FontResourcesConstants.SYS_BI_L;
199:            /** System, underline, large */
200:            public final static int SYS_U_L = FontResourcesConstants.SYS_U_L;
201:            /** System, underline italic, large */
202:            public final static int SYS_UI_L = FontResourcesConstants.SYS_UI_L;
203:            /** System, underline bold, large */
204:            public final static int SYS_UB_L = FontResourcesConstants.SYS_UB_L;
205:            /** System, underline bold italic, large */
206:            public final static int SYS_UBI_L = FontResourcesConstants.SYS_UBI_L;
207:
208:            /**
209:             * This is a static convenience method for retrieving a
210:             * system Font object based on an identifier. The identifier
211:             * must be one of the values defined in FontResourcesConstants, 
212:             * ie, MONO_S_P, SYS_L_UBI, etc.
213:             *
214:             * @param fontID the integer identifier for the Font to retrieve
215:             * @return the system Font corresponding to the given integer id,
216:             *         null if the fontID is not a valid identifier.
217:             *         Note, this Font may not be exactly what is requested and
218:             *         has the same caveats as the normal Font constructor in
219:             *         terms of what gets returned versus the parameters given.
220:             */
221:            static Font getFont(int fontID) {
222:                int face, size, style;
223:
224:                if (fontID >= 700) {
225:                    face = Font.FACE_SYSTEM;
226:                    fontID -= 700;
227:                } else if (fontID >= 400) {
228:                    face = Font.FACE_PROPORTIONAL;
229:                    fontID -= 400;
230:                } else if (fontID >= 100) {
231:                    face = Font.FACE_MONOSPACE;
232:                    fontID -= 100;
233:                } else {
234:                    return null;
235:                }
236:
237:                if (fontID >= 200) {
238:                    size = Font.SIZE_LARGE;
239:                    fontID -= 200;
240:                } else if (fontID >= 100) {
241:                    size = Font.SIZE_MEDIUM;
242:                    fontID -= 100;
243:                } else {
244:                    size = Font.SIZE_SMALL;
245:                }
246:
247:                switch (fontID) {
248:                case 0:
249:                    style = Font.STYLE_PLAIN;
250:                    break;
251:                case 1:
252:                    style = Font.STYLE_ITALIC;
253:                    break;
254:                case 2:
255:                    style = Font.STYLE_BOLD;
256:                    break;
257:                case 3:
258:                    style = Font.STYLE_ITALIC | Font.STYLE_BOLD;
259:                    break;
260:                case 4:
261:                    style = Font.STYLE_UNDERLINED;
262:                    break;
263:                case 5:
264:                    style = Font.STYLE_UNDERLINED | Font.STYLE_ITALIC;
265:                    break;
266:                case 6:
267:                    style = Font.STYLE_UNDERLINED | Font.STYLE_BOLD;
268:                    break;
269:                case 7:
270:                    style = Font.STYLE_UNDERLINED | Font.STYLE_BOLD
271:                            | Font.STYLE_ITALIC;
272:                    break;
273:                default:
274:                    return null;
275:                }
276:
277:                return Font.getFont(face, style, size);
278:            }
279:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.