+ JPanel licensePanel = new JPanel(new BorderLayout(12, 12));
+ licensePanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
+
+ JPanel licenseHeaderPanel = new JPanel(new FlowLayout());
+ licensePanel.add(licenseHeaderPanel, BorderLayout.PAGE_START);
+
+ licenseHeaderLabel = new I18nLabel("aboutDialog.page.license.header", Version.getVersion());
+ licenseHeaderPanel.add(licenseHeaderLabel);
+ licenseHeaderLabel.setAlignmentX(0.5f);
+
+ String licenseText = loadLicenseText();
+ JTextArea licenseArea = new JTextArea(licenseText, 25, 80);
+ licensePanel.add(new JScrollPane(licenseArea), BorderLayout.CENTER);
+ licenseArea.setFont(new Font("Courier", Font.PLAIN, licenseArea.getFont().getSize()));
+ licenseArea.setEditable(false);
+
+ return licensePanel;
+ }
+
+ /**
+ * Loads the license text.
+ *
+ * @return The license text
+ */
+ private String loadLicenseText() {
+ InputStream licenseInputStream = getClass().getResourceAsStream("/LICENSE");
+ if (licenseInputStream == null) {
+ return "Could not load LICENSE, check your installation.";
+ }
+ ByteArrayOutputStream licenseOutputStream = new ByteArrayOutputStream(20000);
+ try {
+ StreamCopier.copy(licenseInputStream, licenseOutputStream);
+ } catch (IOException e) {
+ return "Could not load LICENSE, check your installation.";
+ }
+ String licenseText;
+ try {
+ licenseText = new String(licenseOutputStream.toByteArray(), "ISO-8859-1");
+ } catch (UnsupportedEncodingException e) {
+ licenseText = new String(licenseOutputStream.toByteArray());
+ }
+ return licenseText;
+ }
+
+ //
+ // PRIVATE ACTIONS
+ //
+
+ /**
+ * Closes the dialog.
+ */
+ private void actionOkay() {
+ setVisible(false);
+ }
+
+ //
+ // INTERFACE I18nable
+ //
+
+ /**
+ * @see net.pterodactylus.jsite.i18n.I18nable#updateI18n()
+ */
+ public void updateI18n() {
+ contributorsLabel.updateI18n();
+ licenseHeaderLabel.updateI18n();
+ i18nMaintainerLabel.updateI18n();
+ codeUsageLabel.updateI18n();
+ i18nMaintainerNameLabel.setText(I18n.get("i18n.maintainer.name") + " <" + I18n.get("i18n.maintainer.email") + ">");
+ okayAction.updateI18n();
+ setTitle(I18n.get("aboutDialog.title"));
+ pagesPane.setTitleAt(0, I18n.get("aboutDialog.page.about.title"));
+ pagesPane.setToolTipTextAt(0, I18n.get("aboutDialog.page.about.shortDescription"));
+ pagesPane.setTitleAt(1, I18n.get("aboutDialog.page.license.title"));
+ pagesPane.setToolTipTextAt(1, I18n.get("aboutDialog.page.license.shortDescription"));
+ SwingUtils.repackCentered(this);