X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2FAboutScreen.java;fp=tim%2Fprune%2Ffunction%2FAboutScreen.java;h=0f20ba00778064254a86ddbf2a1d0681f5d1aeb2;hb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;hp=0000000000000000000000000000000000000000;hpb=52bf9e8686c916be37a26a0b75340393d4478b05;p=GpsPrune.git diff --git a/tim/prune/function/AboutScreen.java b/tim/prune/function/AboutScreen.java new file mode 100644 index 0000000..0f20ba0 --- /dev/null +++ b/tim/prune/function/AboutScreen.java @@ -0,0 +1,323 @@ +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.InputStream; + +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.GpsPruner; +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; + /** 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("Prune"); + 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") + ": " + GpsPruner.VERSION_NUMBER); + versionLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); + aboutPanel.add(versionLabel); + JLabel buildLabel = new JLabel(I18nManager.getText("dialog.about.build") + ": " + GpsPruner.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("deutsch, english, español, français, italiano, polski,
" + + "schwiizerdüütsch, português, bahasa indonesia, română").append("

"); + 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