Source Code Cross Referenced for ExceptionDialog.java in  » Project-Management » memoranda » net » sf » memoranda » ui » 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 » Project Management » memoranda » net.sf.memoranda.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.memoranda.ui;
002:
003:        import java.awt.*;
004:        import javax.swing.*;
005:        import java.awt.event.*;
006:        import java.io.*;
007:        import net.sf.memoranda.util.*;
008:
009:        /*$Id: ExceptionDialog.java,v 1.2 2004/10/18 19:09:10 ivanrise Exp $*/
010:        public class ExceptionDialog extends JDialog {
011:            JPanel panel1 = new JPanel();
012:            BorderLayout borderLayout1 = new BorderLayout();
013:            private JPanel jPanel1 = new JPanel();
014:            private JLabel jLabel1 = new JLabel();
015:            private JPanel jPanel2 = new JPanel();
016:            private JLabel jLabel2 = new JLabel();
017:            private BorderLayout borderLayout2 = new BorderLayout();
018:            private BorderLayout borderLayout3 = new BorderLayout();
019:            private JLabel descLabel = new JLabel();
020:
021:            private String description;
022:            private String tip;
023:            private String trace;
024:            private JPanel jPanel3 = new JPanel();
025:            private JScrollPane jScrollPane1 = new JScrollPane();
026:            private JTextArea traceTextArea = new JTextArea();
027:            private JButton reportB = new JButton();
028:            private JButton closeB = new JButton();
029:            private FlowLayout flowLayout1 = new FlowLayout();
030:            private JPanel jPanel4 = new JPanel();
031:            private JButton copyB = new JButton();
032:            private BorderLayout borderLayout4 = new BorderLayout();
033:
034:            private Frame owner;
035:
036:            public ExceptionDialog(Exception exc, String description, String tip) {
037:                super (App.getFrame(), "Problem", true);
038:                exc.printStackTrace();
039:                owner = App.getFrame();
040:                if ((description != null) && (description.length() > 0))
041:                    this .description = description;
042:                else if (exc.getMessage() != null)
043:                    this .description = exc.getMessage();
044:                else
045:                    this .description = "Unknown error";
046:                this .tip = tip;
047:                StringWriter sw = new StringWriter();
048:                exc.printStackTrace(new PrintWriter(sw));
049:                this .trace = sw.toString();
050:                try {
051:                    jbInit();
052:                    setVisible(true);
053:                } catch (Exception ex) {
054:                    ex.printStackTrace();
055:                }
056:            }
057:
058:            public ExceptionDialog(Exception exc) {
059:                this (exc, "", "");
060:            }
061:
062:            public ExceptionDialog() {
063:                this (null, "", "");
064:            }
065:
066:            private void jbInit() throws Exception {
067:                panel1.setLayout(borderLayout1);
068:                jPanel1.setBackground(Color.white);
069:                jPanel1.setLayout(borderLayout3);
070:                jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
071:                jLabel1.setHorizontalAlignment(SwingConstants.LEFT);
072:                jLabel1.setHorizontalTextPosition(SwingConstants.RIGHT);
073:                jLabel1.setText("Problem occured");
074:                jLabel1.setIcon(new ImageIcon(
075:                        net.sf.memoranda.ui.ExceptionDialog.class
076:                                .getResource("resources/icons/error.png")));
077:
078:                jLabel2.setFont(new java.awt.Font("Dialog", 0, 11));
079:                jLabel2
080:                        .setText("<html>An internal exception occured. It is may be a result of bug in the "
081:                                + "program, corrupted data, incorrect configuration or hardware failure.<br><br>"
082:                                + "Click on <b>Report bug..</b> button to submit a bug to the Memoranda bugs tracker on SourceForge.net </html>");
083:                jPanel2.setLayout(borderLayout2);
084:                jPanel2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
085:                borderLayout3.setVgap(5);
086:                String labelText = "<html><b>Description:</b><br>"
087:                        + description;
088:                if ((tip != null) && (tip.length() > 0))
089:                    labelText = labelText + "<br><br><b>Tip:</b><br>" + tip;
090:                labelText = labelText + "<br><br><b>Stack trace:</b></html>";
091:                descLabel.setText(labelText);
092:                descLabel.setFont(new java.awt.Font("Dialog", 0, 12));
093:                jScrollPane1.setEnabled(false);
094:                reportB.setMaximumSize(new Dimension(120, 25));
095:                reportB.setMinimumSize(new Dimension(120, 25));
096:                reportB.setPreferredSize(new Dimension(120, 25));
097:                reportB.setText("Report bug...");
098:                reportB.addActionListener(new java.awt.event.ActionListener() {
099:                    public void actionPerformed(ActionEvent e) {
100:                        reportB_actionPerformed(e);
101:                    }
102:                });
103:                closeB.setMaximumSize(new Dimension(120, 25));
104:                closeB.setMinimumSize(new Dimension(120, 25));
105:                closeB.setPreferredSize(new Dimension(120, 25));
106:                closeB.setText("Close");
107:                closeB.addActionListener(new java.awt.event.ActionListener() {
108:                    public void actionPerformed(ActionEvent e) {
109:                        closeB_actionPerformed(e);
110:                    }
111:                });
112:                this .getRootPane().setDefaultButton(closeB);
113:                jPanel3.setLayout(flowLayout1);
114:                flowLayout1.setAlignment(FlowLayout.RIGHT);
115:                copyB.setText("Copy to clipboard");
116:                copyB.addActionListener(new java.awt.event.ActionListener() {
117:                    public void actionPerformed(ActionEvent e) {
118:                        copyB_actionPerformed(e);
119:                    }
120:                });
121:                copyB.setHorizontalAlignment(SwingConstants.RIGHT);
122:                jPanel4.setLayout(borderLayout4);
123:                traceTextArea.setText(trace);
124:                traceTextArea.setEditable(false);
125:                borderLayout1.setVgap(5);
126:                getContentPane().add(panel1);
127:                panel1.add(jPanel1, BorderLayout.NORTH);
128:                jPanel1.add(jLabel1, BorderLayout.NORTH);
129:                jPanel1.add(jLabel2, BorderLayout.CENTER);
130:                panel1.add(jPanel2, BorderLayout.CENTER);
131:                jPanel2.add(descLabel, BorderLayout.NORTH);
132:                jPanel2.add(jScrollPane1, BorderLayout.CENTER);
133:                jPanel2.add(jPanel4, BorderLayout.SOUTH);
134:                jPanel4.add(copyB, BorderLayout.WEST);
135:                jScrollPane1.getViewport().add(traceTextArea, null);
136:                panel1.add(jPanel3, BorderLayout.SOUTH);
137:                jPanel3.add(closeB, null);
138:                jPanel3.add(reportB, null);
139:                Dimension dlgSize = new Dimension(400, 500);
140:                this .setSize(dlgSize);
141:                if (owner != null) {
142:                    Dimension frmSize = owner.getSize();
143:                    Point loc = owner.getLocation();
144:                    this .setLocation((frmSize.width - dlgSize.width) / 2
145:                            + loc.x, (frmSize.height - dlgSize.height) / 2
146:                            + loc.y);
147:                }
148:            }
149:
150:            void copyB_actionPerformed(ActionEvent e) {
151:                traceTextArea.selectAll();
152:                traceTextArea.copy();
153:                traceTextArea.setSelectionEnd(0);
154:            }
155:
156:            void closeB_actionPerformed(ActionEvent e) {
157:                this .dispose();
158:            }
159:
160:            void reportB_actionPerformed(ActionEvent e) {
161:                Util.runBrowser(App.BUGS_TRACKER_URL);
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.