< prev index next >

src/share/classes/sun/tools/jconsole/AboutDialog.java

Print this page
rev 1501 : 7017818: NLS: JConsoleResources.java cannot be handled by translation team
Reviewed-by: mchung, mfang
rev 1509 : 8014048: Online user guide of jconsole points incorrect link
Reviewed-by: mchung, sla, jbachorik

*** 28,97 **** import java.awt.*; import java.awt.event.*; import java.beans.PropertyVetoException; import java.net.URI; - import javax.accessibility.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import static java.awt.BorderLayout.*; - import static sun.tools.jconsole.Resources.*; import static sun.tools.jconsole.Utilities.*; @SuppressWarnings("serial") public class AboutDialog extends InternalDialog { private static final Color textColor = new Color(87, 88, 89); private static final Color bgColor = new Color(232, 237, 241); private static final Color borderColor = Color.black; private Icon mastheadIcon = ! new MastheadIcon(getText("Help.AboutDialog.masthead.title")); private static AboutDialog aboutDialog; private JLabel statusBar; private Action closeAction; public AboutDialog(JConsole jConsole) { ! super(jConsole, Resources.getText("Help.AboutDialog.title"), false); ! setAccessibleDescription(this, ! getText("Help.AboutDialog.accessibleDescription")); setDefaultCloseOperation(HIDE_ON_CLOSE); setResizable(false); JComponent cp = (JComponent)getContentPane(); createActions(); JLabel mastheadLabel = new JLabel(mastheadIcon); setAccessibleName(mastheadLabel, ! getText("Help.AboutDialog.masthead.accessibleName")); JPanel mainPanel = new TPanel(0, 0); mainPanel.add(mastheadLabel, NORTH); String jConsoleVersion = Version.getVersion(); String vmName = System.getProperty("java.vm.name"); String vmVersion = System.getProperty("java.vm.version"); ! String urlStr = getText("Help.AboutDialog.userGuideLink.url"); if (isBrowseSupported()) { urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; } JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10)); infoAndLogoPanel.setBackground(bgColor); String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); JEditorPane helpLink = new JEditorPane("text/html", "<html><font color=#"+ colorStr + ">" + ! getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion) + ! "<p>" + getText("Help.AboutDialog.javaVersion", (vmName +", "+ vmVersion)) + ! "<p>" + getText("Help.AboutDialog.userGuideLink", urlStr) + ! "</html>"); helpLink.setOpaque(false); helpLink.setEditable(false); helpLink.setForeground(textColor); mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); --- 28,95 ---- import java.awt.*; import java.awt.event.*; import java.beans.PropertyVetoException; import java.net.URI; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; + import static sun.misc.Version.jdkMinorVersion; + import static java.awt.BorderLayout.*; import static sun.tools.jconsole.Utilities.*; @SuppressWarnings("serial") public class AboutDialog extends InternalDialog { private static final Color textColor = new Color(87, 88, 89); private static final Color bgColor = new Color(232, 237, 241); private static final Color borderColor = Color.black; private Icon mastheadIcon = ! new MastheadIcon(Messages.HELP_ABOUT_DIALOG_MASTHEAD_TITLE); private static AboutDialog aboutDialog; private JLabel statusBar; private Action closeAction; public AboutDialog(JConsole jConsole) { ! super(jConsole, Messages.HELP_ABOUT_DIALOG_TITLE, false); ! setAccessibleDescription(this, Messages.HELP_ABOUT_DIALOG_ACCESSIBLE_DESCRIPTION); setDefaultCloseOperation(HIDE_ON_CLOSE); setResizable(false); JComponent cp = (JComponent)getContentPane(); createActions(); JLabel mastheadLabel = new JLabel(mastheadIcon); setAccessibleName(mastheadLabel, ! Messages.HELP_ABOUT_DIALOG_MASTHEAD_ACCESSIBLE_NAME); JPanel mainPanel = new TPanel(0, 0); mainPanel.add(mastheadLabel, NORTH); String jConsoleVersion = Version.getVersion(); String vmName = System.getProperty("java.vm.name"); String vmVersion = System.getProperty("java.vm.version"); ! String urlStr = getOnlineDocUrl(); if (isBrowseSupported()) { urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>"; } JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10)); infoAndLogoPanel.setBackground(bgColor); String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF); JEditorPane helpLink = new JEditorPane("text/html", "<html><font color=#"+ colorStr + ">" + ! Resources.format(Messages.HELP_ABOUT_DIALOG_JCONSOLE_VERSION, jConsoleVersion) + ! "<p>" + Resources.format(Messages.HELP_ABOUT_DIALOG_JAVA_VERSION, (vmName +", "+ vmVersion)) + ! "<p>" + urlStr + "</html>"); helpLink.setOpaque(false); helpLink.setEditable(false); helpLink.setForeground(textColor); mainPanel.setBorder(BorderFactory.createLineBorder(borderColor)); infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
*** 153,163 **** static void showAboutDialog(JConsole jConsole) { getAboutDialog(jConsole).showDialog(); } static void browseUserGuide(JConsole jConsole) { ! getAboutDialog(jConsole).browse(getText("Help.AboutDialog.userGuideLink.url")); } static boolean isBrowseSupported() { return (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)); --- 151,161 ---- static void showAboutDialog(JConsole jConsole) { getAboutDialog(jConsole).showDialog(); } static void browseUserGuide(JConsole jConsole) { ! getAboutDialog(jConsole).browse(getOnlineDocUrl()); } static boolean isBrowseSupported() { return (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE));
*** 174,191 **** } } } private void createActions() { ! closeAction = new AbstractAction(getText("Close")) { public void actionPerformed(ActionEvent ev) { setVisible(false); statusBar.setText(""); } }; } private static class TPanel extends JPanel { TPanel(int hgap, int vgap) { super(new BorderLayout(hgap, vgap)); setOpaque(false); } --- 172,195 ---- } } } private void createActions() { ! closeAction = new AbstractAction(Messages.CLOSE) { public void actionPerformed(ActionEvent ev) { setVisible(false); statusBar.setText(""); } }; } + private static String getOnlineDocUrl() { + String version = Integer.toString(jdkMinorVersion()); + return Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL, + version); + } + private static class TPanel extends JPanel { TPanel(int hgap, int vgap) { super(new BorderLayout(hgap, vgap)); setOpaque(false); }
< prev index next >