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