[593] | 1 | package net.oni2.aeinstaller.gui.about;
|
---|
| 2 |
|
---|
| 3 | import java.awt.event.ActionEvent;
|
---|
| 4 | import java.awt.event.KeyEvent;
|
---|
| 5 | import java.util.ResourceBundle;
|
---|
| 6 |
|
---|
| 7 | import javax.swing.AbstractAction;
|
---|
| 8 | import javax.swing.JComponent;
|
---|
| 9 | import javax.swing.JDialog;
|
---|
| 10 | import javax.swing.JLabel;
|
---|
| 11 | import javax.swing.KeyStroke;
|
---|
| 12 |
|
---|
| 13 | import net.oni2.aeinstaller.gui.HTMLLinkLabel;
|
---|
[840] | 14 | import net.oni2.resourcebundle.UTF8ResourceBundleLoader;
|
---|
[593] | 15 |
|
---|
| 16 | import org.javabuilders.BuildResult;
|
---|
| 17 | import org.javabuilders.swing.SwingJavaBuilder;
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * @author Christian Illy
|
---|
| 21 | */
|
---|
| 22 | public class AboutDialog extends JDialog {
|
---|
| 23 | private static final long serialVersionUID = 1632257865019785612L;
|
---|
| 24 |
|
---|
[840] | 25 | private ResourceBundle bundle = UTF8ResourceBundleLoader.getBundle(getClass()
|
---|
[593] | 26 | .getName());
|
---|
| 27 | @SuppressWarnings("unused")
|
---|
| 28 | private BuildResult result = SwingJavaBuilder.build(this, bundle);
|
---|
| 29 |
|
---|
[772] | 30 | private JLabel lblAppname;
|
---|
[593] | 31 | private HTMLLinkLabel txtLinks;
|
---|
[755] | 32 | private HTMLLinkLabel lblAE;
|
---|
[593] | 33 |
|
---|
| 34 | /**
|
---|
| 35 | * Open the dialog
|
---|
| 36 | */
|
---|
| 37 | public AboutDialog() {
|
---|
[772] | 38 | lblAppname.setText(SwingJavaBuilder.getConfig().getResource("appname")
|
---|
[593] | 39 | + SwingJavaBuilder.getConfig().getResource("appversion"));
|
---|
| 40 |
|
---|
| 41 | txtLinks.setText(bundle.getString("Links"));
|
---|
[755] | 42 | lblAE.setText(bundle.getString("ae"));
|
---|
[593] | 43 |
|
---|
| 44 | pack();
|
---|
| 45 |
|
---|
| 46 | AbstractAction closeAction = new AbstractAction() {
|
---|
| 47 |
|
---|
| 48 | private static final long serialVersionUID = 1L;
|
---|
| 49 |
|
---|
| 50 | public void actionPerformed(ActionEvent arg0) {
|
---|
| 51 | dispose();
|
---|
| 52 | }
|
---|
| 53 | };
|
---|
| 54 | KeyStroke ksCtrlW = KeyStroke
|
---|
| 55 | .getKeyStroke('W', KeyEvent.CTRL_DOWN_MASK);
|
---|
| 56 | getRootPane()
|
---|
| 57 | .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
|
---|
| 58 | .put(ksCtrlW, "close");
|
---|
| 59 | getRootPane().getActionMap().put("close", closeAction);
|
---|
[641] | 60 |
|
---|
| 61 | setLocationRelativeTo(null);
|
---|
[593] | 62 | }
|
---|
| 63 |
|
---|
| 64 | }
|
---|