Source Code Cross Referenced for DemoUtility.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » demo » impl » 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 » Internationalization Localization » icu4j » com.ibm.icu.dev.demo.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *******************************************************************************
003:         * Copyright (C) 1997-2004, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */
007:        package com.ibm.icu.dev.demo.impl;
008:
009:        import java.awt.*;
010:        import java.util.*;
011:
012:        public class DemoUtility {
013:            public static final Font titleFont = new Font("TimesRoman",
014:                    Font.BOLD, 18);
015:            public static final Font labelFont = new Font("TimesRoman",
016:                    Font.BOLD, 14);
017:            public static final Font choiceFont = new Font("Helvetica",
018:                    Font.BOLD, 12);
019:            public static final Font editFont = new Font("Helvetica",
020:                    Font.PLAIN, 14);
021:            public static final Font creditFont = new Font("Helvetica",
022:                    Font.PLAIN, 10);
023:            public static final Font numberFont = new Font("sansserif",
024:                    Font.PLAIN, 14);
025:
026:            public static final Color bgColor = Color.lightGray;
027:            public static final Color choiceColor = Color.white;
028:
029:            public static final String copyright1 = "Copyright (C) IBM Corp and others. 1997 - 2002 All Rights Reserved";
030:
031:            /**
032:            Provides easy way to use basic functions of GridBagLayout, without
033:            the complications. After building a panel, and inserting all the
034:             * subcomponents, call this to lay it out in the desired number of columns.
035:             */
036:            public static void fixGrid(Container cont, int columns) {
037:                GridBagLayout gridbag = new GridBagLayout();
038:                cont.setLayout(gridbag);
039:
040:                GridBagConstraints c = new GridBagConstraints();
041:                c.fill = GridBagConstraints.VERTICAL;
042:                c.weightx = 1.0;
043:                c.insets = new Insets(2, 2, 2, 2);
044:
045:                Component[] components = cont.getComponents();
046:                for (int i = 0; i < components.length; ++i) {
047:                    // not used int colNumber = i%columns;
048:                    c.gridwidth = 1; // default
049:                    if ((i % columns) == columns - 1)
050:                        c.gridwidth = GridBagConstraints.REMAINDER; // last in grid
051:                    if (components[i] instanceof  Label) {
052:                        switch (((Label) components[i]).getAlignment()) {
053:                        case Label.CENTER:
054:                            c.anchor = GridBagConstraints.CENTER;
055:                            break;
056:                        case Label.LEFT:
057:                            c.anchor = GridBagConstraints.WEST;
058:                            break;
059:                        case Label.RIGHT:
060:                            c.anchor = GridBagConstraints.EAST;
061:                            break;
062:                        }
063:                    }
064:                    gridbag.setConstraints(components[i], c);
065:                }
066:
067:            }
068:
069:            /**
070:            Provides easy way to change the spacing around an object in a GridBagLayout.
071:            Call AFTER fixGridBag, passing in the container, the component, and the
072:            new insets.
073:             */
074:            public static void setInsets(Container cont, Component comp,
075:                    Insets insets) {
076:                GridBagLayout gbl = (GridBagLayout) cont.getLayout();
077:                GridBagConstraints g = gbl.getConstraints(comp);
078:                g.insets = insets;
079:                gbl.setConstraints(comp, g);
080:            }
081:
082:            public static Panel createSpacer() {
083:                Panel spacer = new Panel();
084:                spacer.setLayout(null);
085:                spacer.setSize(1000, 1);
086:                return spacer;
087:            }
088:
089:            // to avoid goofy updates and misplaced cursors
090:            public static void setText(TextComponent area, String newText) {
091:                String foo = area.getText();
092:                if (foo.equals(newText))
093:                    return;
094:                area.setText(newText);
095:            }
096:
097:            /**
098:             * Compares two locals. Return value is negative
099:             * if they're different, and more positive the more
100:             * fields that match.
101:             */
102:
103:            public static int compareLocales(Locale l1, Locale l2) {
104:                int result = -1;
105:
106:                if (l1.getLanguage().equals(l2.getLanguage())) {
107:                    result += 1;
108:
109:                    if (l1.getCountry().equals(l2.getCountry())) {
110:                        result += 1;
111:
112:                        if (l1.getVariant().equals(l2.getVariant())) {
113:                            result += 1;
114:                        }
115:                    }
116:                }
117:
118:                return result;
119:            }
120:
121:            /**
122:             * Get the G7 locale list for demos.
123:             */
124:            public static Locale[] getG7Locales() {
125:                return localeList;
126:            }
127:
128:            private static Locale[] localeList = { new Locale("DA", "DK", ""),
129:                    new Locale("EN", "US", ""), new Locale("EN", "GB", ""),
130:                    new Locale("EN", "CA", ""), new Locale("FR", "FR", ""),
131:                    new Locale("FR", "CA", ""), new Locale("DE", "DE", ""),
132:                    new Locale("IT", "IT", ""),
133:            //new Locale("JA", "JP", ""),
134:            };
135:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.