Skip to content

Commit

Permalink
feat: about dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceh121 committed Oct 3, 2023
1 parent 3288f2c commit 0e63406
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
39 changes: 39 additions & 0 deletions launcher/src/me/vinceh121/wanderer/launcher/AboutDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package me.vinceh121.wanderer.launcher;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;

import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.event.HyperlinkEvent.EventType;

public class AboutDialog extends JDialog {
private static final long serialVersionUID = 1L;

public AboutDialog() {
this.setTitle("About Wanderer");

final JEditorPane txt = new JEditorPane();
txt.setEditable(false);
txt.addHyperlinkListener(e -> {
try {
if (e.getEventType() == EventType.ACTIVATED) {
Desktop.getDesktop().browse(e.getURL().toURI());
}
} catch (IOException | URISyntaxException e1) {
e1.printStackTrace();
}
});
txt.setContentType("text/html");
txt.setText(
"<h1>Wanderer</h1>" + "<p>A reimplementation of the 2002 video game Project Nomads by Radon Labs</p>"
+ "<p><a href='https://github.com/vinceh121/wanderer'>Source code</a></p>"
+ "<p>Licensed under the GNU AGPL V3</p>");

this.add(txt);

this.pack();
this.setLocationRelativeTo(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public InstallationInformationDialog() throws StreamReadException, DatabindExcep
final JLabel lblVoiceLang = new JLabel("Voice languages");
lblVoiceLang.setFont(lblVoiceLang.getFont().deriveFont(Font.BOLD, 16));
this.add(lblVoiceLang);

for (final Locale a : available) {
final JCheckBox chkbx = new JCheckBox();
chkbx.setEnabled(false);
Expand All @@ -60,6 +60,8 @@ public InstallationInformationDialog() throws StreamReadException, DatabindExcep
this.add(chkbx);
}

this.setTitle("Installation languages");
this.pack();
this.setLocationRelativeTo(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public void windowClosing(final WindowEvent e) {
}
});
mnHelp.add(mntInstallDetails);

JMenuItem mntAbout = new JMenuItem("About");
mntAbout.addActionListener(e -> new AboutDialog().setVisible(true));
mnHelp.add(mntAbout);
}

private void onClose() {
Expand Down

0 comments on commit 0e63406

Please sign in to comment.