28 import java.awt.*; |
28 import java.awt.*; |
29 import java.awt.event.*; |
29 import java.awt.event.*; |
30 import java.beans.PropertyVetoException; |
30 import java.beans.PropertyVetoException; |
31 import java.net.URI; |
31 import java.net.URI; |
32 |
32 |
33 import javax.accessibility.*; |
|
34 import javax.swing.*; |
33 import javax.swing.*; |
35 import javax.swing.border.*; |
34 import javax.swing.border.*; |
36 import javax.swing.event.*; |
35 import javax.swing.event.*; |
37 |
36 |
|
37 |
38 import static java.awt.BorderLayout.*; |
38 import static java.awt.BorderLayout.*; |
39 import static sun.tools.jconsole.Resources.*; |
|
40 import static sun.tools.jconsole.Utilities.*; |
39 import static sun.tools.jconsole.Utilities.*; |
41 |
40 |
42 @SuppressWarnings("serial") |
41 @SuppressWarnings("serial") |
43 public class AboutDialog extends InternalDialog { |
42 public class AboutDialog extends InternalDialog { |
44 |
43 |
45 private static final Color textColor = new Color(87, 88, 89); |
44 private static final Color textColor = new Color(87, 88, 89); |
46 private static final Color bgColor = new Color(232, 237, 241); |
45 private static final Color bgColor = new Color(232, 237, 241); |
47 private static final Color borderColor = Color.black; |
46 private static final Color borderColor = Color.black; |
48 |
47 |
49 private Icon mastheadIcon = |
48 private Icon mastheadIcon = |
50 new MastheadIcon(getText("Help.AboutDialog.masthead.title")); |
49 new MastheadIcon(Messages.HELP_ABOUT_DIALOG_MASTHEAD_TITLE); |
51 |
50 |
52 private static AboutDialog aboutDialog; |
51 private static AboutDialog aboutDialog; |
53 |
52 |
54 private JLabel statusBar; |
53 private JLabel statusBar; |
55 private Action closeAction; |
54 private Action closeAction; |
56 |
55 |
57 public AboutDialog(JConsole jConsole) { |
56 public AboutDialog(JConsole jConsole) { |
58 super(jConsole, Resources.getText("Help.AboutDialog.title"), false); |
57 super(jConsole, Messages.HELP_ABOUT_DIALOG_TITLE, false); |
59 |
58 |
60 setAccessibleDescription(this, |
59 setAccessibleDescription(this, Messages.HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION); |
61 getText("Help.AboutDialog.accessibleDescription")); |
|
62 setDefaultCloseOperation(HIDE_ON_CLOSE); |
60 setDefaultCloseOperation(HIDE_ON_CLOSE); |
63 setResizable(false); |
61 setResizable(false); |
64 JComponent cp = (JComponent)getContentPane(); |
62 JComponent cp = (JComponent)getContentPane(); |
65 |
63 |
66 createActions(); |
64 createActions(); |
67 |
65 |
68 JLabel mastheadLabel = new JLabel(mastheadIcon); |
66 JLabel mastheadLabel = new JLabel(mastheadIcon); |
69 setAccessibleName(mastheadLabel, |
67 setAccessibleName(mastheadLabel, |
70 getText("Help.AboutDialog.masthead.accessibleName")); |
68 Messages.HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME); |
71 |
69 |
72 JPanel mainPanel = new TPanel(0, 0); |
70 JPanel mainPanel = new TPanel(0, 0); |
73 mainPanel.add(mastheadLabel, NORTH); |
71 mainPanel.add(mastheadLabel, NORTH); |
74 |
72 |
75 String jConsoleVersion = Version.getVersion(); |
73 String jConsoleVersion = Version.getVersion(); |
76 String vmName = System.getProperty("java.vm.name"); |
74 String vmName = System.getProperty("java.vm.name"); |
77 String vmVersion = System.getProperty("java.vm.version"); |
75 String vmVersion = System.getProperty("java.vm.version"); |
78 String urlStr = getText("Help.AboutDialog.userGuideLink.url"); |
76 String urlStr = Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL; |
79 if (isBrowseSupported()) { |
77 if (isBrowseSupported()) { |
80 urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; |
78 urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; |
81 } |
79 } |
82 |
80 |
83 JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10)); |
81 JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10)); |
84 infoAndLogoPanel.setBackground(bgColor); |
82 infoAndLogoPanel.setBackground(bgColor); |
85 |
83 |
86 String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); |
84 String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); |
87 JEditorPane helpLink = new JEditorPane("text/html", |
85 JEditorPane helpLink = new JEditorPane("text/html", |
88 "<html><font color=#"+ colorStr + ">" + |
86 "<html><font color=#"+ colorStr + ">" + |
89 getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion) + |
87 Resources.format(Messages.HELP_ABOUT_DIALOG_JCONSOLE_VERSION, jConsoleVersion) + |
90 "<p>" + getText("Help.AboutDialog.javaVersion", (vmName +", "+ vmVersion)) + |
88 "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_JAVA_VERSION, (vmName +", "+ vmVersion)) + |
91 "<p>" + getText("Help.AboutDialog.userGuideLink", urlStr) + |
89 "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK, urlStr) + |
92 "</html>"); |
90 "</html>"); |
93 helpLink.setOpaque(false); |
91 helpLink.setOpaque(false); |
94 helpLink.setEditable(false); |
92 helpLink.setEditable(false); |
95 helpLink.setForeground(textColor); |
93 helpLink.setForeground(textColor); |
96 mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); |
94 mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); |