1 package net.sf.openrocket.gui.dialogs;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
6 import javax.swing.JButton;
7 import javax.swing.JDialog;
8 import javax.swing.JFrame;
9 import javax.swing.JLabel;
10 import javax.swing.JPanel;
12 import net.miginfocom.swing.MigLayout;
13 import net.sf.openrocket.gui.components.StyledLabel;
14 import net.sf.openrocket.gui.components.URLLabel;
15 import net.sf.openrocket.util.Chars;
16 import net.sf.openrocket.util.GUIUtil;
17 import net.sf.openrocket.util.Icons;
18 import net.sf.openrocket.util.Prefs;
20 public class AboutDialog extends JDialog {
22 public static final String OPENROCKET_URL = "http://openrocket.sourceforge.net/";
25 public AboutDialog(JFrame parent) {
28 final String version = Prefs.getVersion();
30 JPanel panel = new JPanel(new MigLayout("fill"));
32 panel.add(new JLabel(Icons.loadImageIcon("pix/icon/icon-about.png", "OpenRocket")),
35 panel.add(new StyledLabel("OpenRocket", 20), "ax 50%, growy, wrap para");
36 panel.add(new StyledLabel("Version " + version, 3), "ax 50%, growy, wrap rel");
38 // String source = Prefs.getBuildSource();
39 // if (!Prefs.DEFAULT_BUILD_SOURCE.equalsIgnoreCase(source)) {
40 // panel.add(new StyledLabel("Distributed by " + source, -1),
41 // "ax 50%, growy, wrap para");
43 // panel.add(new StyledLabel(" ", -1), "ax 50%, growy, wrap para");
46 panel.add(new StyledLabel("Copyright " + Chars.COPY + " 2007-2011 Sampo Niskanen"),
47 "ax 50%, growy, wrap para");
49 panel.add(new URLLabel(OPENROCKET_URL), "ax 50%, growy, wrap para");
52 JButton close = new JButton("Close");
53 close.addActionListener(new ActionListener() {
55 public void actionPerformed(ActionEvent e) {
56 AboutDialog.this.dispose();
59 panel.add(close, "spanx, right");
62 this.setTitle("OpenRocket " + version);
64 this.setResizable(false);
65 this.setLocationRelativeTo(parent);
67 GUIUtil.setDisposableDialogOptions(this, close);