]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/gui/AboutScreen.java
Version 1, September 2006
[GpsPrune.git] / tim / prune / gui / AboutScreen.java
1 package tim.prune.gui;
2
3 import java.awt.Component;
4 import java.awt.Font;
5 import java.awt.event.ActionEvent;
6 import java.awt.event.ActionListener;
7
8 import javax.swing.BorderFactory;
9 import javax.swing.BoxLayout;
10 import javax.swing.JButton;
11 import javax.swing.JDialog;
12 import javax.swing.JEditorPane;
13 import javax.swing.JFrame;
14 import javax.swing.JLabel;
15 import javax.swing.JPanel;
16
17 import tim.prune.GpsPruner;
18 import tim.prune.I18nManager;
19
20 /**
21  * Class to represent the "About" popup window
22  */
23 public class AboutScreen extends JDialog
24 {
25
26         /**
27          * Constructor
28          */
29         public AboutScreen(JFrame inParent)
30         {
31                 super(inParent, I18nManager.getText("dialog.about.title"));
32                 getContentPane().add(makeContents());
33         }
34
35
36         /**
37          * @return the contents of the window as a Component
38          */
39         private Component makeContents()
40         {
41                 JPanel mainPanel = new JPanel();
42                 mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
43                 mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
44                 JLabel titleLabel = new JLabel("Prune");
45                 titleLabel.setFont(new Font("SansSerif", Font.BOLD, 24));
46                 titleLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
47                 mainPanel.add(titleLabel);
48                 JLabel versionLabel = new JLabel(I18nManager.getText("dialog.about.version") + ": " + GpsPruner.VERSION_NUMBER);
49                 versionLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
50                 mainPanel.add(versionLabel);
51                 JLabel buildLabel = new JLabel(I18nManager.getText("dialog.about.build") + ": " + GpsPruner.BUILD_NUMBER);
52                 buildLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
53                 mainPanel.add(buildLabel);
54                 mainPanel.add(new JLabel(" "));
55                 StringBuffer descBuffer = new StringBuffer();
56                 descBuffer.append("<p>").append(I18nManager.getText("dialog.about.summarytext1")).append("</p>");
57                 descBuffer.append("<p>").append(I18nManager.getText("dialog.about.summarytext2")).append("</p>");
58                 descBuffer.append("<p>").append(I18nManager.getText("dialog.about.summarytext3")).append("</p>");
59                 JEditorPane descPane = new JEditorPane("text/html", descBuffer.toString());
60                 descPane.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
61                 descPane.setEditable(false);
62                 descPane.setOpaque(false);
63                 descPane.setAlignmentX(JEditorPane.CENTER_ALIGNMENT);
64                 // descPane.setBackground(Color.GRAY);
65                 mainPanel.add(descPane);
66                 mainPanel.add(new JLabel(" "));
67                 JButton okButton = new JButton(I18nManager.getText("button.ok"));
68                 okButton.addActionListener(new ActionListener()
69                 {
70                         public void actionPerformed(ActionEvent e)
71                         {
72                                 dispose();
73                         }
74                 });
75                 okButton.setAlignmentX(JButton.CENTER_ALIGNMENT);
76                 mainPanel.add(okButton);
77                 return mainPanel;
78         }
79
80
81         /**
82          * Show window
83          */
84         public void show()
85         {
86                 pack();
87                 // setSize(300,200);
88                 super.show();
89         }
90 }