source: josm/trunk/src/org/openstreetmap/josm/actions/AboutAction.java@ 2358

Last change on this file since 2358 was 2358, checked in by Gubaer, 14 years ago

fixed #3305: Version is UNKNOWN
fixed #3429: created_by=* includes the wrong language when uploading from a new layer

  • Property svn:eol-style set to native
File size: 4.1 KB
Line 
1//License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.Dimension;
7import java.awt.Font;
8import java.awt.GridBagLayout;
9import java.awt.event.ActionEvent;
10import java.awt.event.KeyEvent;
11
12import javax.swing.BorderFactory;
13import javax.swing.JLabel;
14import javax.swing.JOptionPane;
15import javax.swing.JPanel;
16import javax.swing.JScrollPane;
17import javax.swing.JTabbedPane;
18import javax.swing.JTextArea;
19
20import org.openstreetmap.josm.Main;
21import org.openstreetmap.josm.data.Version;
22import org.openstreetmap.josm.plugins.PluginHandler;
23import org.openstreetmap.josm.tools.GBC;
24import org.openstreetmap.josm.tools.ImageProvider;
25import org.openstreetmap.josm.tools.Shortcut;
26import org.openstreetmap.josm.tools.UrlLabel;
27
28/**
29 * Nice about screen. I guess every application need one these days.. *sigh*
30 *
31 * The REVISION resource is read and if present, it shows the revision
32 * information of the jar-file.
33 *
34 * @author imi
35 */
36public class AboutAction extends JosmAction {
37
38 public AboutAction() {
39 super(tr("About"), "about", tr("Display the about screen."), Shortcut.registerShortcut("system:about", tr("About"), KeyEvent.VK_F1, Shortcut.GROUP_DIRECT, Shortcut.SHIFT_DEFAULT), true);
40 }
41
42 public void actionPerformed(ActionEvent e) {
43 JTabbedPane about = new JTabbedPane();
44
45 JTextArea readme = new JTextArea();
46 readme.setEditable(false);
47 readme.setText(Version.loadResourceFile(Main.class.getResource("/README")));
48
49 JTextArea contribution = new JTextArea();
50 contribution.setEditable(false);
51 contribution.setText(Version.loadResourceFile(Main.class.getResource("/CONTRIBUTION")));
52
53 JTextArea license = new JTextArea();
54 license.setEditable(false);
55 license.setText(Version.loadResourceFile(Main.class.getResource("/LICENSE")));
56
57 Version version = Version.getInstance();
58
59 JPanel info = new JPanel(new GridBagLayout());
60 JLabel caption = new JLabel("JOSM - " + tr("Java OpenStreetMap Editor"));
61 caption.setFont(new Font("Helvetica", Font.BOLD, 20));
62 info.add(caption, GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0));
63 info.add(GBC.glue(0,10), GBC.eol());
64 info.add(new JLabel(tr("Version {0}", version.getVersionString())), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0));
65 info.add(GBC.glue(0,5), GBC.eol());
66 info.add(new JLabel(tr("Last change at {0}",version.getTime())), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0));
67 info.add(GBC.glue(0,5), GBC.eol());
68 info.add(new JLabel(tr("Java Version {0}",System.getProperty("java.version"))), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0));
69 info.add(GBC.glue(0,10), GBC.eol());
70 info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0));
71 info.add(new UrlLabel("http://josm.openstreetmap.de"), GBC.eol().fill(GBC.HORIZONTAL));
72 info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10,0,10,0));
73 info.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eol().fill(GBC.HORIZONTAL));
74
75 JTextArea revision = new JTextArea();
76 revision.setEditable(false);
77 revision.setText(version.getRevision());
78 about.addTab(tr("Info"), info);
79 about.addTab(tr("Readme"), createScrollPane(readme));
80 about.addTab(tr("Revision"), createScrollPane(revision));
81 about.addTab(tr("Contribution"), createScrollPane(contribution));
82 about.addTab(tr("License"), createScrollPane(license));
83 about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel()));
84
85 about.setPreferredSize(new Dimension(500,300));
86
87 JOptionPane.showMessageDialog(Main.parent, about, tr("About JOSM..."),
88 JOptionPane.INFORMATION_MESSAGE, ImageProvider.get("logo"));
89 }
90
91 private JScrollPane createScrollPane(JTextArea area) {
92 area.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
93 area.setOpaque(false);
94 JScrollPane sp = new JScrollPane(area);
95 sp.setBorder(null);
96 sp.setOpaque(false);
97 return sp;
98 }
99}
Note: See TracBrowser for help on using the repository browser.