Source Code Cross Referenced for AboutDialog.java in  » 6.0-JDK-Modules-sun » tools » sun » tools » jconsole » 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 » 6.0 JDK Modules sun » tools » sun.tools.jconsole 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package sun.tools.jconsole;
027:
028:        import java.awt.*;
029:        import java.awt.event.*;
030:        import java.beans.PropertyVetoException;
031:        import java.net.URI;
032:
033:        import javax.accessibility.*;
034:        import javax.swing.*;
035:        import javax.swing.border.*;
036:        import javax.swing.event.*;
037:
038:        import static java.awt.BorderLayout.*;
039:        import static sun.tools.jconsole.Resources.*;
040:        import static sun.tools.jconsole.Utilities.*;
041:
042:        @SuppressWarnings("serial")
043:        public class AboutDialog extends InternalDialog {
044:
045:            private static final Color textColor = new Color(87, 88, 89);
046:            private static final Color bgColor = new Color(232, 237, 241);
047:            private static final Color borderColor = Color.black;
048:
049:            private Icon mastheadIcon = new MastheadIcon(
050:                    getText("Help.AboutDialog.masthead.title"));
051:
052:            private static AboutDialog aboutDialog;
053:
054:            private JLabel statusBar;
055:            private Action closeAction;
056:
057:            public AboutDialog(JConsole jConsole) {
058:                super (jConsole, Resources.getText("Help.AboutDialog.title"),
059:                        false);
060:
061:                setAccessibleDescription(this ,
062:                        getText("Help.AboutDialog.accessibleDescription"));
063:                setDefaultCloseOperation(HIDE_ON_CLOSE);
064:                setResizable(false);
065:                JComponent cp = (JComponent) getContentPane();
066:
067:                createActions();
068:
069:                JLabel mastheadLabel = new JLabel(mastheadIcon);
070:                setAccessibleName(mastheadLabel,
071:                        getText("Help.AboutDialog.masthead.accessibleName"));
072:
073:                JPanel mainPanel = new TPanel(0, 0);
074:                mainPanel.add(mastheadLabel, NORTH);
075:
076:                String jConsoleVersion = Version.getVersion();
077:                String vmName = System.getProperty("java.vm.name");
078:                String vmVersion = System.getProperty("java.vm.version");
079:                String urlStr = getText("Help.AboutDialog.userGuideLink.url");
080:                if (isBrowseSupported()) {
081:                    urlStr = "<a style='color:#35556b' href=\"" + urlStr
082:                            + "\">" + urlStr + "</a>";
083:                }
084:
085:                JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10));
086:                infoAndLogoPanel.setBackground(bgColor);
087:
088:                String colorStr = String.format("%06x",
089:                        textColor.getRGB() & 0xFFFFFF);
090:                JEditorPane helpLink = new JEditorPane("text/html",
091:                        "<html><font color=#"
092:                                + colorStr
093:                                + ">"
094:                                + getText("Help.AboutDialog.jConsoleVersion",
095:                                        jConsoleVersion)
096:                                + "<p>"
097:                                + getText("Help.AboutDialog.javaVersion",
098:                                        (vmName + ", " + vmVersion))
099:                                + "<p>"
100:                                + getText("Help.AboutDialog.userGuideLink",
101:                                        urlStr) + "</html>");
102:                helpLink.setOpaque(false);
103:                helpLink.setEditable(false);
104:                helpLink.setForeground(textColor);
105:                mainPanel
106:                        .setBorder(BorderFactory.createLineBorder(borderColor));
107:                infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10,
108:                        10, 10, 10));
109:                helpLink.addHyperlinkListener(new HyperlinkListener() {
110:                    public void hyperlinkUpdate(HyperlinkEvent e) {
111:                        if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
112:                            browse(e.getDescription());
113:                        }
114:                    }
115:                });
116:                infoAndLogoPanel.add(helpLink, NORTH);
117:
118:                ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource(
119:                        "resources/brandlogo.png"));
120:                JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING);
121:
122:                JButton closeButton = new JButton(closeAction);
123:
124:                JPanel bottomPanel = new TPanel(0, 0);
125:                JPanel buttonPanel = new JPanel(new FlowLayout(
126:                        FlowLayout.TRAILING));
127:                buttonPanel.setOpaque(false);
128:
129:                mainPanel.add(infoAndLogoPanel, CENTER);
130:                cp.add(bottomPanel, SOUTH);
131:
132:                infoAndLogoPanel.add(brandLogo, SOUTH);
133:
134:                buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12));
135:                buttonPanel.add(closeButton);
136:                bottomPanel.add(buttonPanel, NORTH);
137:
138:                statusBar = new JLabel(" ");
139:                bottomPanel.add(statusBar, SOUTH);
140:
141:                cp.add(mainPanel, NORTH);
142:
143:                pack();
144:                setLocationRelativeTo(jConsole);
145:                Utilities.updateTransparency(this );
146:            }
147:
148:            public void showDialog() {
149:                statusBar.setText(" ");
150:                setVisible(true);
151:                try {
152:                    // Bring to front of other dialogs
153:                    setSelected(true);
154:                } catch (PropertyVetoException e) {
155:                    // ignore
156:                }
157:            }
158:
159:            private static AboutDialog getAboutDialog(JConsole jConsole) {
160:                if (aboutDialog == null) {
161:                    aboutDialog = new AboutDialog(jConsole);
162:                }
163:                return aboutDialog;
164:            }
165:
166:            static void showAboutDialog(JConsole jConsole) {
167:                getAboutDialog(jConsole).showDialog();
168:            }
169:
170:            static void browseUserGuide(JConsole jConsole) {
171:                getAboutDialog(jConsole).browse(
172:                        getText("Help.AboutDialog.userGuideLink.url"));
173:            }
174:
175:            static boolean isBrowseSupported() {
176:                return (Desktop.isDesktopSupported() && Desktop.getDesktop()
177:                        .isSupported(Desktop.Action.BROWSE));
178:            }
179:
180:            void browse(String urlStr) {
181:                try {
182:                    Desktop.getDesktop().browse(new URI(urlStr));
183:                } catch (Exception ex) {
184:                    showDialog();
185:                    statusBar.setText(ex.getLocalizedMessage());
186:                    if (JConsole.isDebug()) {
187:                        ex.printStackTrace();
188:                    }
189:                }
190:            }
191:
192:            private void createActions() {
193:                closeAction = new AbstractAction(getText("Close")) {
194:                    public void actionPerformed(ActionEvent ev) {
195:                        setVisible(false);
196:                        statusBar.setText("");
197:                    }
198:                };
199:            }
200:
201:            private static class TPanel extends JPanel {
202:                TPanel(int hgap, int vgap) {
203:                    super (new BorderLayout(hgap, vgap));
204:                    setOpaque(false);
205:                }
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.