package tim.prune.function; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import tim.prune.App; import tim.prune.ExternalTools; import tim.prune.GenericFunction; import tim.prune.GpsPrune; import tim.prune.I18nManager; import tim.prune.threedee.WindowFactory; /** * Class to represent the "About" popup window */ public class AboutScreen extends GenericFunction { private JDialog _dialog = null; private JTabbedPane _tabs = null; private JButton _okButton = null; private JTextArea _aboutTextArea = null; /** Labels for whether tools installed or not */ private JLabel[] _installedLabels = null; /** * Constructor * @param inApp app object */ public AboutScreen(App inApp) { super(inApp); } /** * Return the name key for this function */ public String getNameKey() { return "function.about"; } /** * @return the contents of the window as a Component */ private Component makeContents() { JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); _tabs = new JTabbedPane(); mainPanel.add(_tabs, BorderLayout.CENTER); JPanel aboutPanel = new JPanel(); aboutPanel.setLayout(new BoxLayout(aboutPanel, BoxLayout.Y_AXIS)); aboutPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel titleLabel = new JLabel("GpsPrune"); titleLabel.setFont(new Font("SansSerif", Font.BOLD, 24)); titleLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(titleLabel); JLabel versionLabel = new JLabel(I18nManager.getText("dialog.about.version") + ": " + GpsPrune.VERSION_NUMBER); versionLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(versionLabel); JLabel buildLabel = new JLabel(I18nManager.getText("dialog.about.build") + ": " + GpsPrune.BUILD_NUMBER); buildLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); aboutPanel.add(buildLabel); aboutPanel.add(new JLabel(" ")); StringBuffer descBuffer = new StringBuffer(); descBuffer.append("

").append(I18nManager.getText("dialog.about.summarytext1")).append("

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.summarytext2")).append("

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.summarytext3")).append("

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.languages")).append(" : ") .append("afrikaans, \u010de\u0161tina, deutsch, english, espa\u00F1ol, fran\u00E7ais, italiano,
" + " magyar, nederlands, polski, portugu\u00EAs, rom\u00E2n\u0103, suomi, svenska, \u0440\u0443\u0441\u0441\u043a\u0438\u0439 (russian),
" + " \u4e2d\u6587 (chinese), \u65E5\u672C\u8A9E (japanese), \uD55C\uAD6D\uC5B4/\uC870\uC120\uB9D0 (korean), schwiizerd\u00FC\u00FCtsch

"); descBuffer.append("

").append(I18nManager.getText("dialog.about.translatedby")).append("

"); JEditorPane descPane = new JEditorPane("text/html", descBuffer.toString()); descPane.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); descPane.setEditable(false); descPane.setOpaque(false); descPane.setAlignmentX(JEditorPane.CENTER_ALIGNMENT); aboutPanel.add(descPane); aboutPanel.add(new JLabel(" ")); _tabs.add(I18nManager.getText("function.about"), aboutPanel); // Second pane for system info JPanel sysInfoPanel = new JPanel(); GridBagLayout gridBag = new GridBagLayout(); sysInfoPanel.setLayout(gridBag); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 0.0; constraints.weighty = 0.0; addToGridBagPanel(sysInfoPanel, gridBag, constraints, new JLabel(I18nManager.getText("dialog.about.systeminfo.os") + " : "), 0, 0); addToGridBagPanel(sysInfoPanel, gridBag, constraints, new JLabel(System.getProperty("os.name")), 1, 0); addToGridBagPanel(sysInfoPanel, gridBag, constraints, new JLabel(I18nManager.getText("dialog.about.systeminfo.java") + " : "), 0, 1); addToGridBagPanel(sysInfoPanel, gridBag, constraints, new JLabel(System.getProperty("java.runtime.version")), 1, 1); // Create install labels to be populated later final int NUM_INSTALL_CHECKS = 5; _installedLabels = new JLabel[NUM_INSTALL_CHECKS]; for (int i=0; i