package de.gurkenlabs.utiliti.swing.menus;

import java.net.URI;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;

import de.gurkenlabs.litiengine.Game;
import de.gurkenlabs.litiengine.resources.Resources;
import de.gurkenlabs.litiengine.util.UriUtilities;

@SuppressWarnings("serial")
public final class HelpMenu extends JMenu {
  private static final String LINKS = "links";

  public HelpMenu() {
    super(Resources.strings().get("menu_help"));
    this.setMnemonic('H');

    JMenuItem docsMenuItem = new JMenuItem(Resources.strings().get("menu_help_docs"));
    docsMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_docs"))));

    JMenuItem javadocsMenuItem = new JMenuItem(Resources.strings().get("menu_help_javadocs"));
    javadocsMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_javadocs"))));

    JMenuItem tutorialMenuItem = new JMenuItem(Resources.strings().get("menu_help_tutorials"));
    tutorialMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_tutorials"))));

    JMenuItem forumMenuItem = new JMenuItem(Resources.strings().get("menu_help_forum"));
    forumMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_forum"))));

    JMenuItem bugMenuItem = new JMenuItem(Resources.strings().get("menu_help_bug"));
    bugMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_bug"))));

    JMenuItem releaseMenuItem = new JMenuItem(Resources.strings().get("menu_help_releasenotes"));
    releaseMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_LITIengine_releasenotes"))));

    JMenuItem openCollectiveMenuItem = new JMenuItem(Resources.strings().get("menu_help_opencollective"));
    openCollectiveMenuItem.addActionListener(event -> UriUtilities.openWebpage(URI.create(Resources.strings().getFrom(LINKS, "link_opencollective"))));

    String aboutMessage = String.format("%s%n%n%s", Resources.strings().get("menu_help_abouttext"), Resources.strings().get("copyright", "2020"));
    String aboutTitle = String.format("%s %s, %s", Resources.strings().get("menu_help_about"), Resources.strings().get("menu_help_utiliti"), Game.info().getVersion());
    JMenuItem aboutMenuItem = new JMenuItem(Resources.strings().get("menu_help_about"));
    aboutMenuItem.addActionListener(event -> JOptionPane.showMessageDialog(((JFrame) Game.window().getHostControl()), aboutMessage, aboutTitle, JOptionPane.INFORMATION_MESSAGE));

    this.add(docsMenuItem);
    this.add(javadocsMenuItem);
    this.add(tutorialMenuItem);
    this.add(forumMenuItem);
    this.addSeparator();
    this.add(releaseMenuItem);
    this.add(bugMenuItem);
    this.addSeparator();
    this.add(openCollectiveMenuItem);
    this.add(aboutMenuItem);
  }
}

@@ -2235,24 +2235,142 @@
 tive%22))));%0A%0A
+    String javaVersion = System.getProperty(%22java.version%22) + %22 (vendor: %22 + System.getProperty(%22java.vendor%22) + %22)%22;%0A
     String a
@@ -2404,16 +2404,28 @@
 (%22%25s%25n%25n
+%25s%25n%25nJava: 
 %25s%22, Res
@@ -2513,16 +2513,29 @@
  %222020%22)
+, javaVersion
 );%0A    S

Add Java version to the about window.