Source Code Cross Referenced for AboutDialog.java in  » Profiler » gcviewer » com » tagtraum » perf » gcviewer » 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 » Profiler » gcviewer » com.tagtraum.perf.gcviewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.tagtraum.perf.gcviewer;
002:
003:        import javax.swing.*;
004:        import javax.swing.border.EtchedBorder;
005:        import javax.swing.border.SoftBevelBorder;
006:        import java.awt.*;
007:        import java.awt.event.ActionEvent;
008:        import java.awt.event.ActionListener;
009:        import java.util.ResourceBundle;
010:        import java.net.URL;
011:        import java.net.URLDecoder;
012:        import java.net.MalformedURLException;
013:        import java.io.IOException;
014:
015:        /**
016:         * About dialog.
017:         *
018:         * @author Hendrik Schreiber
019:         * @version $Id: $
020:         */
021:        public class AboutDialog extends JDialog implements  ActionListener {
022:
023:            /**
024:             * Source-Version
025:             */
026:            public static String vcid = "$Id: AboutDialog.java,v 1.1.1.1 2002/01/15 19:48:45 hendriks73 Exp $";
027:            private static ResourceBundle localStrings = ResourceBundle
028:                    .getBundle("com.tagtraum.perf.gcviewer.localStrings");
029:            private static final String GCVIEWER_HOMEPAGE = "http://www.tagtraum.com/";
030:
031:            private Frame frame;
032:
033:            public AboutDialog(Frame f) {
034:                super (f, localStrings.getString("about_dialog_title"), true);
035:                this .frame = f;
036:                setLocation(20, 20);
037:                Panel panel0 = new Panel();
038:                ImageIcon logoIcon = new ImageIcon(getClass().getResource(
039:                        localStrings.getString("about_dialog_image")));
040:                JLabel la_icon = new JLabel(logoIcon);
041:                //la_icon.setBorder(new EtchedBorder(EtchedBorder.LOWERED));
042:                la_icon.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED));
043:                panel0.add(la_icon);
044:                Panel panel2 = new Panel();
045:                panel2.setLayout(new FlowLayout(FlowLayout.RIGHT));
046:                if (ExternalViewer.isSupported()) {
047:                    try {
048:                        JButton homepageButton = new JButton("Homepage");
049:                        homepageButton.addActionListener(new ExternalViewer(
050:                                new URL(GCVIEWER_HOMEPAGE)));
051:                        panel2.add(homepageButton);
052:                    } catch (MalformedURLException e) {
053:                        // should never happen
054:                        e.printStackTrace();
055:                    }
056:                }
057:
058:                JButton okButton = new JButton(localStrings
059:                        .getString("button_ok"));
060:                okButton.setActionCommand("ok");
061:                okButton.addActionListener(this );
062:                panel2.add(okButton);
063:                getContentPane().add("North", panel0);
064:                // getContentPane().add("Center",panel1);
065:                getContentPane().add("South", panel2);
066:                pack();
067:                setResizable(false);
068:                setVisible(false);
069:            }
070:
071:            public void actionPerformed(ActionEvent e) {
072:                String cmd = e.getActionCommand();
073:                if (cmd.equals("ok")) {
074:                    setVisible(false);
075:                }
076:            }
077:
078:            public void setVisible(boolean visible) {
079:                if (visible)
080:                    setLocation((int) frame.getLocation().getX()
081:                            + (frame.getWidth() / 2) - (getWidth() / 2),
082:                            (int) frame.getLocation().getY()
083:                                    + (frame.getHeight() / 2)
084:                                    - (getHeight() / 2));
085:                super .setVisible(visible);
086:            }
087:
088:            private static class ExternalViewer implements  ActionListener {
089:
090:                private static final boolean WINDOWS = System.getProperty(
091:                        "os.name").toLowerCase().startsWith("win");
092:                private static final boolean MAC = System
093:                        .getProperty("os.name").toLowerCase().indexOf("mac") != -1;
094:
095:                // The default system browser under Mac OS X.
096:                private static final String MAC_PATH = "open";
097:                // The default system browser under WINDOWS.
098:                private static final String WIN_PATH = "rundll32";
099:                // The flag to display a url.
100:                private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
101:
102:                private URL url;
103:
104:                public ExternalViewer(URL url) {
105:                    this .url = url;
106:                }
107:
108:                public void actionPerformed(ActionEvent e) {
109:                    try {
110:                        displayURL(url);
111:                    } catch (IOException e1) {
112:                        e1.printStackTrace();
113:                    }
114:                }
115:
116:                /**
117:                 * Display a file in the system browser.  If you want to display a
118:                 * file, you must include the absolute path name.
119:                 *
120:                 * @param url the file's url (the url must start with either "http://" or
121:                 *            "file://").
122:                 */
123:                public static void displayURL(URL url) throws IOException {
124:                    String cmd = null;
125:                    String urlString = url.toString();
126:                    if (WINDOWS) {
127:                        // cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
128:                        // make sure, file URLs start with file:// instead of just file:/
129:                        if (urlString.startsWith("file:/")) {
130:                            if (!urlString.startsWith("file://")) {
131:                                urlString = "file://"
132:                                        + urlString
133:                                                .substring("file:/".length());
134:                            }
135:                        }
136:                        // replace %20 with spaces
137:                        try {
138:                            urlString = URLDecoder.decode(urlString);
139:                        } catch (Exception e) {
140:                            e.printStackTrace();
141:                        }
142:                        cmd = WIN_PATH + " " + WIN_FLAG + " " + urlString;
143:                        /*
144:                        if (urlString.startsWith("file:")) {
145:                        }
146:                        else {
147:                            cmd = "rundll32.exe msconf.dll,CallToProtocolHandler " + urlString;
148:                        }
149:                         */
150:                        Runtime.getRuntime().exec(cmd);
151:                    } else if (MAC) {
152:                        // TODO: fix this!
153:                        // hack to display jsps in TextEdit
154:                        if (urlString.endsWith(".jsp")
155:                                || urlString.endsWith(".jspx")) {
156:                            cmd = MAC_PATH + " -e "
157:                                    + urlString.substring("file:".length());
158:                        } else {
159:                            cmd = MAC_PATH + " " + url;
160:                        }
161:                        Runtime.getRuntime().exec(cmd);
162:                    }
163:                }
164:
165:                public static boolean isSupported() {
166:                    return WINDOWS || MAC;
167:                }
168:            }
169:
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.