Source Code Cross Referenced for SwingUtensil.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » rules » utensil » 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 » ERP CRM Financial » SourceTap CRM » org.ofbiz.rules.utensil 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.ofbiz.rules.utensil;
002:
003:        import java.awt.*;
004:        import java.awt.event.*; // import com.sun.java.swing.*;
005:        // import com.sun.java.swing.border.*;
006:        import javax.swing.*;
007:        import javax.swing.border.*;
008:
009:        /**
010:         * <p><b>Title:</b> Swing Utensil
011:         * <p><b>Description:</b> None
012:         * <p>Copyright (c) 1999 Steven J. Metsker.
013:         * <p>Copyright (c) 2001 The Open For Business Project - www.ofbiz.org
014:         *
015:         * <p>Permission is hereby granted, free of charge, to any person obtaining a
016:         *  copy of this software and associated documentation files (the "Software"),
017:         *  to deal in the Software without restriction, including without limitation
018:         *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
019:         *  and/or sell copies of the Software, and to permit persons to whom the
020:         *  Software is furnished to do so, subject to the following conditions:
021:         *
022:         * <p>The above copyright notice and this permission notice shall be included
023:         *  in all copies or substantial portions of the Software.
024:         *
025:         * <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
026:         *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
027:         *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
028:         *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
029:         *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
030:         *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
031:         *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
032:         *
033:         * <br>
034:         * <p>This class harbors a few handy swing utilities.
035:         *
036:         * @author Steven J. Metsker
037:         * @version 1.0
038:         */
039:        public class SwingUtensil {
040:
041:            /**
042:             * Set the location of a frame to be the center of the
043:             * screen.
044:             */
045:            public static void center(Frame f) {
046:                Dimension sDim = Toolkit.getDefaultToolkit().getScreenSize();
047:
048:                Dimension fDim = f.getSize();
049:
050:                if (fDim.height > sDim.height) {
051:                    fDim.height = sDim.height;
052:                }
053:                if (fDim.width > sDim.width) {
054:                    fDim.width = sDim.width;
055:                }
056:
057:                f.setLocation((sDim.width - fDim.width) / 2,
058:                        (sDim.height - fDim.height) / 2);
059:            }
060:
061:            /**
062:             * A standard font for interactive development environment
063:             * text areas.
064:             */
065:            public static Font ideFont() {
066:                int style = Font.PLAIN;
067:                int size = 18;
068:                String name = "lucida sans typewriter";
069:                Font f = new Font(name, style, size);
070:
071:                if (!f.getFamily().equals(name)) {
072:                    name = "Monospaced";
073:                    f = new Font(name, style, size);
074:                }
075:                return f;
076:            }
077:
078:            /**
079:             * Return a standard text area, with the standard font
080:             * and border, and with word wrapping enabled.
081:             */
082:            public static JTextArea ideTextArea() {
083:                JTextArea ta = new JTextArea();
084:
085:                ta.setFont(ideFont());
086:                ta.setBorder(new EmptyBorder(5, 5, 5, 5));
087:                ta.setLineWrap(true);
088:                return ta;
089:            }
090:
091:            /**
092:             * Return a standard titled border.
093:             */
094:            public static TitledBorder ideTitledBorder(String title) {
095:                TitledBorder tb = BorderFactory.createTitledBorder(
096:                        BorderFactory.createBevelBorder(BevelBorder.RAISED),
097:                        title, TitledBorder.LEFT, TitledBorder.TOP);
098:
099:                tb.setTitleColor(Color.black);
100:                tb.setTitleFont(ideFont());
101:                return tb;
102:            }
103:
104:            /**
105:             * Create a frame with the given title around the given
106:             * component; center and  display the frame; listen for
107:             * exit, closing the frame's window on exit.
108:             */
109:            public static JFrame launch(Component c, String title) {
110:                JFrame frame = new JFrame(title);
111:
112:                frame.getContentPane().add(c);
113:                SwingUtensil.listen(frame);
114:                frame.pack();
115:                SwingUtensil.center(frame);
116:                frame.setVisible(true);
117:                return frame;
118:            }
119:
120:            /**
121:             * Set up an exit listener for a frame.
122:             */
123:            public static void listen(Frame f) {
124:                f.addWindowListener(new WindowAdapter() {
125:                    public void windowClosing(WindowEvent e) {
126:                        System.exit(0);
127:                    };
128:                });
129:            }
130:
131:            /**
132:             * Returns a standard text panel, with a scroll pane around
133:             * a text area, and with a title border.
134:             *
135:             * @param String the panel title
136:             *
137:             * @param JTextArea the text area to wrap
138:             *
139:             * @param Dimension the preferred size for this panel
140:             *
141:             * @param Dimension the minimum size for this panel
142:             *
143:             * @return a standard text panel, with a scroll pane
144:             *         around a text area, and with a title border.
145:             */
146:            public static JPanel textPanel(String title, JTextArea ta,
147:                    Dimension pref, Dimension min) {
148:
149:                // scroll pane around text area
150:                JScrollPane s1 = new JScrollPane(ta);
151:
152:                s1.setPreferredSize(pref);
153:                s1.setMinimumSize(min);
154:
155:                // titled panel that contains scrolling text area
156:                JPanel p = new JPanel();
157:
158:                p.setLayout(new BorderLayout());
159:                p.setBorder(SwingUtensil.ideTitledBorder(title));
160:                p.add(s1, "Center");
161:                return p;
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.