Source Code Cross Referenced for EFCNDialog.java in  » IDE » Schmortopf » Schmortopf » Utility » gui » 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 » IDE » Schmortopf » Schmortopf.Utility.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package Schmortopf.Utility.gui;
002:
003:        import javax.swing.*;
004:        import java.awt.*;
005:
006:        /** some static utilities
007:         1) can be shown modal or not ;
008:         2) thread secure (invokeandwait) can be called from any thread ;
009:         3) write his content in the console (=> outputFile), to help debugging.
010:         */
011:
012:        public class EFCNDialog {
013:
014:            /** show a modal warning dialog
015:             */
016:            public static void showWarning(String message, Component parent) {
017:                optionPane(message, "Warning", parent,
018:                        JOptionPane.WARNING_MESSAGE, null);
019:            }
020:
021:            /** show a modal information dialog attached to the parent
022:             */
023:            public static void showInformation(String message, Component parent) {
024:                optionPane(message, "Information", parent,
025:                        JOptionPane.INFORMATION_MESSAGE, null);
026:            }
027:
028:            /** show a modal error dialog attached to the parent
029:             */
030:            public static void showError(String message, Component parent) {
031:                optionPane(message, "Error", parent, JOptionPane.ERROR_MESSAGE,
032:                        null);
033:            }
034:
035:            /** show a modal question dialog attached to the parent
036:             */
037:            public static void showQuestion(String message, Component parent) {
038:                optionPane(message, "Question", parent,
039:                        JOptionPane.QUESTION_MESSAGE, null);
040:            }
041:
042:            public static String showInputDialog(String message,
043:                    Component parent) {
044:                return JOptionPane.showInputDialog(parent, message);
045:            }
046:
047:            public static int showOptionDialog(String message,
048:                    Component parent, Object[] options, int defaultOption) {
049:                JSenseButton[] js = new JSenseButton[options.length];
050:                for (int i = 0; i < options.length; i++) {
051:                    js[i] = new JSenseButton(options[i].toString(), true, null);
052:                    js[i]
053:                            .addActionListener(new java.awt.event.ActionListener() {
054:                                public void actionPerformed(
055:                                        java.awt.event.ActionEvent e) {
056:                                    return;
057:                                }
058:                            });
059:                }
060:
061:                return JOptionPane.showOptionDialog(parent, message,
062:                        "Option dialog", JOptionPane.DEFAULT_OPTION,
063:                        JOptionPane.QUESTION_MESSAGE, null, options,
064:                        options[defaultOption]);
065:            }
066:
067:            //
068:            // private data and utilities
069:            //
070:
071:            /** All methods use this output method, which runs in all cases.
072:                It must be modal and called with invoke and wait.
073:             */
074:            private static void optionPane(final String message,
075:                    final String title, final Component parent, final int type,
076:                    final ImageIcon im) {
077:                if (SwingUtilities.isEventDispatchThread()) {
078:                    if (message.length() > 300) {
079:                        TextArea ta = new TextArea(message);
080:                        JScrollPane jsp = new JScrollPane(ta);
081:                        jsp.setPreferredSize(new Dimension(500, 220));
082:                        JOptionPane.showMessageDialog(parent, jsp, title, type,
083:                                im);
084:                    } else {
085:                        JOptionPane.showMessageDialog(parent, message, title,
086:                                type, im);
087:                    }
088:                } else {
089:                    try {
090:                        SwingUtilities.invokeAndWait(new Runnable() {
091:                            public void run() {
092:                                if (message.length() > 300) {
093:                                    TextArea ta = new TextArea(message);
094:                                    JScrollPane jsp = new JScrollPane(ta);
095:                                    jsp
096:                                            .setPreferredSize(new Dimension(
097:                                                    500, 220));
098:                                    JOptionPane.showMessageDialog(parent, jsp,
099:                                            title, type, im);
100:                                } else {
101:                                    JOptionPane.showMessageDialog(parent,
102:                                            message, title, type, im);
103:                                }
104:                            }
105:                        });
106:                    } catch (Exception e) {
107:                    }
108:                }
109:            }
110:
111:        } // EFCNDialog
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.