Source Code Cross Referenced for XMessageBox.java in  » XML-UI » XUI » net » xoetrope » swing » 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 » XML UI » XUI » net.xoetrope.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package net.xoetrope.swing;
02:
03:        import java.awt.Container;
04:        import java.awt.Dimension;
05:        import java.awt.Font;
06:        import java.awt.FontMetrics;
07:        import java.awt.Graphics;
08:
09:        import net.xoetrope.xui.XMessageBoxSetup;
10:        import net.xoetrope.xui.XPage;
11:        import javax.swing.SwingUtilities;
12:        import net.xoetrope.xui.build.BuildProperties;
13:
14:        /**
15:         * <p>Creates a simple modal MessageBox with a label for the text
16:         * and a close button </p>
17:         * <p>Copyright (c) Xoetrope Ltd., 1998-2004<br>
18:         * <p>License: see license.txt</p>
19:         * $revision
20:         */
21:        public class XMessageBox extends XDialog implements  XMessageBoxSetup {
22:            protected XButton btnClose;
23:            protected XLabel label;
24:            protected String message;
25:
26:            /**
27:             * Constructor creates the close image and the label for displaying the message.
28:             */
29:            public XMessageBox() {
30:                super (true, DEFAULT_PADDING);
31:                saveOnClose = false;
32:            }
33:
34:            /**
35:             * Setup the content of the message box
36:             * @param title the message box title or caption
37:             * @param msg the text of the message
38:             * @param size the size of the owner page
39:             * @param container the content page
40:             */
41:            public void setup(String title, String msg, Dimension size,
42:                    Container container) {
43:                message = msg;
44:                setCaption(title);
45:
46:                int x = (getSize().width / 2) - (getSize().width / 2);
47:                int y = (getSize().height / 2) - (getSize().height / 2);
48:                setLocation(x, y);
49:
50:                btnClose = (XButton) componentFactory.addComponent(
51:                        XPage.BUTTON, 10, 370, 72, 20, "Close");
52:                label = (XLabel) componentFactory.addComponent(XPage.LABEL, 2,
53:                        2, 30, 20, msg, null);
54:                addActionHandler(btnClose, "closeDlg");
55:
56:                int height = 200;
57:                Graphics g = container.getGraphics();
58:                FontMetrics fm = g.getFontMetrics(new Font(null, 0, 12));
59:                height = fm.getHeight() * (2 + fm.stringWidth(msg) / 380);
60:                g.dispose();
61:                g = null;
62:                setSize(400, height + 44);
63:
64:                if (BuildProperties.BUILD_JDK_118)
65:                    showDialog(container, null);
66:                else {
67:                    final Container myContainer = container;
68:                    SwingUtilities.invokeLater(new Runnable() {
69:                        public void run() {
70:                            showDialog(myContainer, null);
71:                        }
72:                    });
73:                }
74:            }
75:
76:            /**
77:             * Close the dialog.
78:             */
79:            public void closeDlg() {
80:                //    if ( wasMouseClicked()) {
81:                returnValue = 1;
82:                super .closeDlg();
83:                //    }
84:            }
85:
86:            /**
87:             * Adjust the size and locatio of the close image and the message label.
88:             * @param width The new width of the dialog.
89:             * @param height The new height of the dialog.
90:             */
91:            public void setSize(int width, int height) {
92:                btnClose.setLocation(width - btnClose.getSize().width - 10,
93:                        height - btnClose.getSize().height - 8);
94:                label.setSize(width - 6, height - btnClose.getSize().height
95:                        - 10);
96:                super.setSize(width, height);
97:            }
98:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.