Source Code Cross Referenced for TopStyleEditor.java in  » Web-Framework » wingS » com » javujavu » javux » demo » 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 » Web Framework » wingS » com.javujavu.javux.demo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *	Javu WingS - Lightweight Java Component Set
003:         *	Copyright (c) 2005-2007 Krzysztof A. Sadlocha
004:         *	e-mail: ksadlocha@programics.com
005:         *
006:         *	This library is free software; you can redistribute it and/or
007:         *	modify it under the terms of the GNU Lesser General Public
008:         *	License as published by the Free Software Foundation; either
009:         *	version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *	This library is distributed in the hope that it will be useful,
012:         *	but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *	Lesser General Public License for more details.
015:         *
016:         *	You should have received a copy of the GNU Lesser General Public
017:         *	License along with this library; if not, write to the Free Software
018:         *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.javujavu.javux.demo;
022:
023:        import java.awt.Dimension;
024:        import java.awt.Font;
025:        import java.awt.Insets;
026:        import java.awt.Toolkit;
027:        import java.awt.event.ActionEvent;
028:        import java.awt.event.ActionListener;
029:        import java.awt.event.ItemEvent;
030:        import java.awt.event.ItemListener;
031:        import java.util.Vector;
032:        import com.javujavu.javux.util.code.CodeUrl;
033:        import com.javujavu.javux.wings.MenuRadioGroup;
034:        import com.javujavu.javux.wings.Style;
035:        import com.javujavu.javux.wings.WingButton;
036:        import com.javujavu.javux.wings.WingComponent;
037:        import com.javujavu.javux.wings.WingFont;
038:        import com.javujavu.javux.wings.WingImage;
039:        import com.javujavu.javux.wings.WingMenu;
040:        import com.javujavu.javux.wings.WingMenuItem;
041:        import com.javujavu.javux.wings.WingSkin;
042:        import com.javujavu.javux.wings.WingToolkit;
043:        import com.javujavu.javux.wings.extra.ColorItem;
044:        import com.javujavu.javux.wings.extra.FontItem;
045:        import com.javujavu.javux.wings.item.LabelItem;
046:
047:        public class TopStyleEditor implements  ActionListener, ItemListener {
048:            private static int[] colors = { 0xffffff, 0xfffc6d, 0xd6f640,
049:                    0x34f334, 0x38f6a5, 0x1fdfeb, 0x5d9ef6, 0x978ae6, 0xc183f1,
050:                    0xe764ca, 0xf55b92, 0xf50000, 0xeea800, 0xaa7618, 0x3c8613,
051:                    0x007286, 0x0c00ad, 0xa1008a, 0x000000, 0x601eab3f,
052:                    0x803a83cf, 0xa08f2ee4, 0xc0e4701b, 0x80b9dcff };
053:            private static WingImage[] icons;
054:            private static LabelItem[] images;
055:
056:            public/*final*/Style topStyle;
057:
058:            private final Vector foregroundItems = new Vector();
059:            private final Vector backgroundItems = new Vector();
060:            private final Vector borderItems = new Vector();
061:            private final Vector focusItems = new Vector();
062:            private final Vector fontItems = new Vector();
063:            private final Vector sizeItems = new Vector();
064:            private final Vector marginItems = new Vector();
065:            private final Vector stateItems = new Vector();
066:            private final Vector gapItems = new Vector();
067:            private final Vector iconItems = new Vector();
068:            private final Vector imageItems = new Vector();
069:            private WingMenuItem miFontBold;
070:            private WingMenuItem miFontItalic;
071:            private WingMenuItem miFontUnderline;
072:            private WingMenuItem miFontAntialias;
073:
074:            private WingMenu popup;
075:            private/*final*/WingButton button;
076:            private/*final*/WingComponent target;
077:
078:            private/*final*/int initColor;
079:            private/*final*/int initBg;
080:            private/*final*/int initBorder;
081:
082:            public TopStyleEditor(WingButton button, WingComponent target,
083:                    int initFontSize, int initColor, boolean antialias) {
084:                this (button, target, initFontSize, initColor, 0, 0, antialias);
085:            }
086:
087:            public TopStyleEditor(WingButton button, WingComponent target,
088:                    int initFontSize, int initColor, int initBg,
089:                    int initBorder, boolean antialias) {
090:                this .target = target;
091:                this .initColor = initColor;
092:                this .initBg = initBg;
093:                this .initBorder = initBorder;
094:                topStyle = new Style();
095:                topStyle.state = -1;
096:                if (initFontSize >= 5) {
097:                    topStyle.font = new WingFont("Dialog", 0, initFontSize,
098:                            false, antialias);
099:                }
100:                if (initColor > 1 && initColor <= colors.length) {
101:                    topStyle.foreground = WingToolkit.the().createColor(
102:                            colors[initColor - 1]);
103:                }
104:                if (initBg > 1 && initBg <= colors.length) {
105:                    topStyle.background = WingToolkit.the().createColor(
106:                            colors[initBg - 1]);
107:                }
108:                if (initBorder > 1 && initBorder <= colors.length) {
109:                    topStyle.border = WingToolkit.the().createColor(
110:                            colors[initBorder - 1]);
111:                }
112:                this .button = button;
113:                target.setTopStyle(topStyle);
114:                button.addActionListener(this );
115:            }
116:
117:            WingMenu menu() {
118:                if (icons == null) {
119:                    WingImage[] img1 = { WingSet.imgCrying, WingSet.imgGlasses,
120:                            WingSet.imgIcon, WingSet.imgEye, WingSet.imgBomb,
121:                            WingSet.imgSeek, WingSet.imgTongue,
122:                            WingSet.imgBigsmileA, WingSet.imgAnim };
123:                    icons = img1;
124:                    LabelItem[] img2 = {
125:                            new LabelItem("imgTextHover", WingSkin.getImage(
126:                                    "imgTextHover", null)),
127:                            new LabelItem("light.tooltip.label.normal",
128:                                    WingSkin.getImage(
129:                                            "light.tooltip.label.normal", null)),
130:                            new LabelItem("border1.panel.normal", WingSkin
131:                                    .getImage("border1.panel.normal", null)),
132:                            new LabelItem("custom_mbox.no.button.normal",
133:                                    WingSkin.getImage(
134:                                            "custom_mbox.no.button.normal",
135:                                            null)),
136:                            new LabelItem("green_icon.panel.normal", WingSkin
137:                                    .getImage("green_icon.panel.normal", null)),
138:                            new LabelItem("aztec.panel.normal", WingSkin
139:                                    .getImage("aztec.panel.normal", null)),
140:                            new LabelItem("aztec3.panel.normal", WingSkin
141:                                    .getImage("aztec3.panel.normal", null)),
142:                            new LabelItem("aztec5.panel.normal", WingSkin
143:                                    .getImage("aztec5.panel.normal", null))
144:                    //				new LabelItem("aztec2.panel.normal", WingSkin.getImage("aztec2.panel.normal", null)),
145:                    //				new LabelItem("aztec4.panel.normal", WingSkin.getImage("aztec4.panel.normal", null))
146:                    };
147:                    images = img2;
148:                }
149:
150:                if (popup == null) {
151:                    popup = new WingMenu("stylepopup");
152:
153:                    String[] names = Toolkit.getDefaultToolkit().getFontList();
154:                    WingMenu m;
155:                    popup.add(m = new WingMenu("Font"));
156:                    MenuRadioGroup g = new MenuRadioGroup();
157:                    WingMenuItem mi;
158:                    m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
159:                    g.add(mi);
160:                    int initFontSize = (topStyle.font != null) ? topStyle.font
161:                            .getFont().getSize() : 0;
162:                    if (initFontSize == 0)
163:                        mi.setSelected(true);
164:                    sizeItems.addElement(mi);
165:                    m.addSeparator();
166:                    for (int i = 5; i <= 20; i++) {
167:                        m.add(mi = new WingMenuItem(new FontItem("Size " + i,
168:                                new WingFont(new Font("Dialog", 0, i))),
169:                                WingMenu.RADIO));
170:                        g.add(mi);
171:                        sizeItems.addElement(mi);
172:                        if (initFontSize == i)
173:                            mi.setSelected(true);
174:                    }
175:                    m.addSeparator();
176:                    g = new MenuRadioGroup();
177:                    for (int i = 0; i < names.length; i++) {
178:                        m.add(mi = new WingMenuItem(new FontItem(names[i],
179:                                new WingFont(new Font(names[i], 0, 12))),
180:                                WingMenu.RADIO));
181:                        g.add(mi);
182:                        fontItems.addElement(mi);
183:                        if (topStyle.font != null
184:                                && topStyle.font.getFont().getName().equals(
185:                                        names[i]))
186:                            mi.setSelected(true);
187:                    }
188:                    m.addSeparator();
189:                    m.add(miFontBold = new WingMenuItem(new FontItem(
190:                            "Style BOLD", new WingFont("Dialog", Font.BOLD, 12,
191:                                    false, false)), WingMenu.CHECKBOX));
192:                    m.add(miFontItalic = new WingMenuItem(new FontItem(
193:                            "Style ITALIC", new WingFont("Dialog", Font.ITALIC,
194:                                    12, false, false)), WingMenu.CHECKBOX));
195:                    m.add(miFontUnderline = new WingMenuItem(new FontItem(
196:                            "Underline", new WingFont("Dialog", Font.PLAIN, 12,
197:                                    true, false)), WingMenu.CHECKBOX));
198:                    m.add(miFontAntialias = new WingMenuItem(new FontItem(
199:                            "Antialiasing", new WingFont("Dialog", Font.PLAIN,
200:                                    12, false, true)), WingMenu.CHECKBOX));
201:                    miFontAntialias.setSelected(topStyle.font != null
202:                            && topStyle.font.isAntialias());
203:
204:                    popup.add(buildColorMenu("Foreground color",
205:                            foregroundItems, initColor));
206:                    popup.add(buildColorMenu("Background color",
207:                            backgroundItems, initBg));
208:
209:                    popup.add(m = new WingMenu("Icon"));
210:                    g = new MenuRadioGroup();
211:                    m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
212:                    g.add(mi);
213:                    iconItems.addElement(mi);
214:                    mi.setSelected(true);
215:                    m.addSeparator();
216:                    for (int i = 0; i < icons.length; i++) {
217:                        m.add(mi = new WingMenuItem(icons[i], WingMenu.RADIO));
218:                        g.add(mi);
219:                        iconItems.addElement(mi);
220:                    }
221:
222:                    popup.add(m = new WingMenu("Image"));
223:                    g = new MenuRadioGroup();
224:                    m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
225:                    g.add(mi);
226:                    imageItems.addElement(mi);
227:                    mi.setSelected(true);
228:                    m.addSeparator();
229:                    for (int i = 0; i < images.length; i++) {
230:                        m.add(mi = new WingMenuItem(images[i], WingMenu.RADIO));
231:                        g.add(mi);
232:                        imageItems.addElement(mi);
233:                    }
234:
235:                    popup.add(buildColorMenu("Border color", borderItems,
236:                            initBorder));
237:                    popup.add(buildColorMenu("Focus color", focusItems, 0));
238:
239:                    popup.add(m = new WingMenu("Margin"));
240:                    g = new MenuRadioGroup();
241:                    m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
242:                    g.add(mi);
243:                    marginItems.addElement(mi);
244:                    mi.setSelected(true);
245:                    m.addSeparator();
246:                    for (int i = 1; i < 20; i += 2) {
247:                        m.add(mi = new WingMenuItem("Margin " + i + "," + i
248:                                + "," + i + "," + i, WingMenu.RADIO));
249:                        g.add(mi);
250:                        marginItems.addElement(mi);
251:                    }
252:                    popup.add(m = new WingMenu("Gap"));
253:                    g = new MenuRadioGroup();
254:                    m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
255:                    g.add(mi);
256:                    gapItems.addElement(mi);
257:                    mi.setSelected(true);
258:                    m.addSeparator();
259:                    for (int i = 1; i < 20; i += 2) {
260:                        m
261:                                .add(mi = new WingMenuItem("Gap " + i,
262:                                        WingMenu.RADIO));
263:                        g.add(mi);
264:                        gapItems.addElement(mi);
265:                    }
266:
267:                    popup.addSeparator();
268:
269:                    popup.add(mi = new WingMenuItem("Modify style NORMAL",
270:                            WingMenu.CHECKBOX));
271:                    mi.setUserData(new Integer(WingButton.NORMAL));
272:                    stateItems.addElement(mi);
273:                    popup.add(mi = new WingMenuItem("Modify style DARK",
274:                            WingMenu.CHECKBOX));
275:                    mi.setUserData(new Integer(WingButton.DARK));
276:                    stateItems.addElement(mi);
277:                    popup.add(mi = new WingMenuItem("Modify style READONLY",
278:                            WingMenu.CHECKBOX));
279:                    mi.setUserData(new Integer(WingButton.READONLY));
280:                    stateItems.addElement(mi);
281:                    popup.add(mi = new WingMenuItem("Modify style PRESSED",
282:                            WingMenu.CHECKBOX));
283:                    mi.setUserData(new Integer(WingButton.PRESSED));
284:                    stateItems.addElement(mi);
285:                    popup.add(mi = new WingMenuItem("Modify style HOVER",
286:                            WingMenu.CHECKBOX));
287:                    mi.setUserData(new Integer(WingButton.HOVER));
288:                    stateItems.addElement(mi);
289:                    popup.add(mi = new WingMenuItem("Modify style FOCUSED",
290:                            WingMenu.CHECKBOX));
291:                    mi.setUserData(new Integer(WingButton.FOCUSED));
292:                    stateItems.addElement(mi);
293:                    popup.add(mi = new WingMenuItem("Modify style SELECTED",
294:                            WingMenu.CHECKBOX));
295:                    mi.setUserData(new Integer(WingButton.SELECTED));
296:                    stateItems.addElement(mi);
297:                    popup.add(mi = new WingMenuItem("Modify style DISABLED",
298:                            WingMenu.CHECKBOX));
299:                    mi.setUserData(new Integer(WingButton.DISABLED));
300:                    stateItems.addElement(mi);
301:                    popup.add(mi = new WingMenuItem("Modify style ON",
302:                            WingMenu.CHECKBOX));
303:                    mi.setUserData(new Integer(WingButton.ON));
304:                    stateItems.addElement(mi);
305:                    popup.add(mi = new WingMenuItem("Modify style ITEM",
306:                            WingMenu.CHECKBOX));
307:                    mi.setUserData(new Integer(WingButton.ITEM));
308:                    stateItems.addElement(mi);
309:                    popup.add(mi = new WingMenuItem("Modify style DOC",
310:                            WingMenu.CHECKBOX));
311:                    mi.setUserData(new Integer(WingButton.DOC));
312:                    stateItems.addElement(mi);
313:
314:                    popup.addActionListener(this );
315:                    popup.addItemListener(this );
316:
317:                    for (int i = 0; i < stateItems.size(); i++) {
318:                        ((WingMenuItem) stateItems.elementAt(i))
319:                                .setSelected(true);
320:                    }
321:                }
322:                return popup;
323:            }
324:
325:            private WingMenu buildColorMenu(String title, Vector items, int init) {
326:                WingMenu m = new WingMenu(title);
327:                MenuRadioGroup g = new MenuRadioGroup();
328:                WingMenuItem mi;
329:                m.add(mi = new WingMenuItem("Default", WingMenu.RADIO));
330:                g.add(mi);
331:                mi.setSelected(true);
332:                items.addElement(mi);
333:                m.addSeparator();
334:                for (int i = 0; i < colors.length; i++) {
335:                    String text = ((colors[i] & 0xff000000) == 0) ? ("RGB #" + CodeUrl
336:                            .toHexString(colors[i], 6))
337:                            : ("ARGB #" + CodeUrl.toHexString(colors[i], 8));
338:                    m.add(mi = new WingMenuItem(new ColorItem(text, WingToolkit
339:                            .the().createColor(colors[i])), WingMenu.RADIO));
340:                    g.add(mi);
341:                    items.addElement(mi);
342:                    if (init - 1 == i)
343:                        mi.setSelected(true);
344:                }
345:                return m;
346:            }
347:
348:            public void actionPerformed(ActionEvent e) {
349:                Object src = e.getSource();
350:                if (src == button) {
351:                    Dimension s = button.getSize();
352:                    menu().showPopup(button, 0, 0, s.width, s.height,
353:                            WingMenu.HORIZONTAL);
354:                }
355:            }
356:
357:            public void itemStateChanged(ItemEvent e) {
358:                Object src = e.getSource();
359:                int index;
360:                boolean update = true;
361:                if ((index = foregroundItems.indexOf(src)) != -1) {
362:                    if (index == 0)
363:                        topStyle.foreground = null;
364:                    else
365:                        topStyle.foreground = WingToolkit.the().createColor(
366:                                colors[index - 1]);
367:                } else if ((index = backgroundItems.indexOf(src)) != -1) {
368:                    if (index == 0)
369:                        topStyle.background = null;
370:                    else
371:                        topStyle.background = WingToolkit.the().createColor(
372:                                colors[index - 1]);
373:                } else if ((index = borderItems.indexOf(src)) != -1) {
374:                    if (index == 0)
375:                        topStyle.border = null;
376:                    else
377:                        topStyle.border = WingToolkit.the().createColor(
378:                                colors[index - 1]);
379:                } else if ((index = focusItems.indexOf(src)) != -1) {
380:                    if (index == 0)
381:                        topStyle.focus = null;
382:                    else
383:                        topStyle.focus = WingToolkit.the().createColor(
384:                                colors[index - 1]);
385:                } else if ((index = stateItems.indexOf(src)) != -1) {
386:                    boolean select = (e.getStateChange() == ItemEvent.SELECTED);
387:                    WingMenuItem mi = (WingMenuItem) src;
388:                    int i = ((Integer) mi.getUserData()).intValue();
389:                    if (select)
390:                        topStyle.state |= i;
391:                    else
392:                        topStyle.state &= (i ^ -1);
393:                } else if ((index = sizeItems.indexOf(src)) != -1) {
394:                    if (index == 0) {
395:                        topStyle.font = null;
396:                        for (int i = 0; i < fontItems.size(); i++) {
397:                            ((WingMenuItem) fontItems.elementAt(i))
398:                                    .setSelected(false);
399:                        }
400:                        miFontBold.setSelected(false);
401:                        miFontItalic.setSelected(false);
402:                        miFontUnderline.setSelected(false);
403:                        miFontAntialias.setSelected(false);
404:                    } else {
405:                        Font f = (topStyle.font != null) ? topStyle.font
406:                                .getFont() : null;
407:                        String face = (f != null) ? f.getName() : "Dialog";
408:                        int style = (f != null) ? f.getStyle() : 0;
409:                        boolean underline = (topStyle.font != null && topStyle.font
410:                                .isUnderline());
411:                        boolean antialias = (topStyle.font != null && topStyle.font
412:                                .isAntialias());
413:                        topStyle.font = new WingFont(face, style,
414:                                5 + index - 1, underline, antialias);
415:                    }
416:                } else if ((index = fontItems.indexOf(src)) != -1) {
417:                    Font f = (topStyle.font != null) ? topStyle.font.getFont()
418:                            : null;
419:                    int style = (f != null) ? f.getStyle() : 0;
420:                    boolean underline = (topStyle.font != null && topStyle.font
421:                            .isUnderline());
422:                    boolean antialias = (topStyle.font != null && topStyle.font
423:                            .isAntialias());
424:                    String face = ((FontItem) ((WingMenuItem) src).getLabel()).text;
425:                    int size = (f != null) ? f.getSize() : 18;
426:                    if (topStyle.font == null) {
427:                        ((WingMenuItem) sizeItems.elementAt(18 - 5 + 1))
428:                                .setSelected(true);
429:                    }
430:                    topStyle.font = new WingFont(face, style, size, underline,
431:                            antialias);
432:                } else if (src == miFontBold || src == miFontItalic
433:                        || src == miFontUnderline || src == miFontAntialias) {
434:                    boolean select = (e.getStateChange() == ItemEvent.SELECTED);
435:                    Font f = (topStyle.font != null) ? topStyle.font.getFont()
436:                            : null;
437:                    int style = (f != null) ? f.getStyle() : 0;
438:                    boolean underline = (topStyle.font != null && topStyle.font
439:                            .isUnderline());
440:                    boolean antialias = (topStyle.font != null && topStyle.font
441:                            .isAntialias());
442:                    if (src == miFontBold) {
443:                        if (select)
444:                            style |= Font.BOLD;
445:                        else
446:                            style &= (Font.BOLD ^ -1);
447:                    } else if (src == miFontItalic) {
448:                        if (select)
449:                            style |= Font.ITALIC;
450:                        else
451:                            style &= (Font.ITALIC ^ -1);
452:                    } else if (src == miFontUnderline) {
453:                        underline = select;
454:                    } else if (src == miFontAntialias) {
455:                        antialias = select;
456:                    }
457:
458:                    int size = (f != null) ? f.getSize() : 18;
459:                    if (topStyle.font == null) {
460:                        ((WingMenuItem) sizeItems.elementAt(18 - 5 + 1))
461:                                .setSelected(true);
462:                    }
463:                    String face = (f != null) ? f.getName() : "Dialog";
464:                    topStyle.font = new WingFont(face, style, size, underline,
465:                            antialias);
466:                } else if ((index = marginItems.indexOf(src)) != -1) {
467:                    index = (index > 0) ? index * 2 - 1 : 0;
468:                    topStyle.margin = new Insets(index, index, index, index);
469:                } else if ((index = gapItems.indexOf(src)) != -1) {
470:                    index = (index > 0) ? index * 2 - 1 : 0;
471:                    topStyle.gap = index;
472:                } else if ((index = iconItems.indexOf(src)) != -1) {
473:                    if (index == 0)
474:                        topStyle.icon = null;
475:                    else
476:                        topStyle.icon = icons[index - 1];
477:                } else if ((index = imageItems.indexOf(src)) != -1) {
478:                    if (index == 0)
479:                        topStyle.image = null;
480:                    else
481:                        topStyle.image = images[index - 1].icon;
482:                } else
483:                    update = false;
484:                if (update)
485:                    target.setTopStyle(topStyle);
486:            }
487:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.