Beispiel #1
0
  public static String getSystemInfoText() {

    ResourceBundle resb = TranslationBundle.getBundle();

    String netInfo, home, cpu, name, info;

    if (checkForNoSandbox()) {
      home = System.getProperty("java.home");
      cpu = System.getProperty("sun.cpu.isalist");
      name =
          System.getProperty("java.runtime.name")
              + " ("
              + System.getProperty("java.runtime.version")
              + ")";
      info = System.getProperty("java.vm.info");

      // we CAN do this outside the sandbox, but for some reason it promps the webstart
      try {
        netInfo =
            InetAddress.getLocalHost().getHostAddress()
                + " ("
                + InetAddress.getLocalHost().getHostName()
                + ")";
      } catch (UnknownHostException e) {
        netInfo = resb.getString("about.nonetwork");
      }
    } else {
      home = "?";
      cpu = "?";
      info = "?";

      if (applet != null) {
        name = "applet";
      } else if (webstart != null) {
        name = "web start (" + webstart + ")";
      } else {
        name = "?";
      }

      netInfo = "?";
    }

    String displayInfo;
    try {
      Toolkit toolkit = Toolkit.getDefaultToolkit();
      displayInfo =
          toolkit.getScreenSize().width
              + "x"
              + toolkit.getScreenSize().height
              + " ("
              + toolkit.getScreenResolution()
              + "dpi) density="
              + GraphicsUtil.density
              + " scale="
              + GraphicsUtil.scale;
    } catch (HeadlessException ex) {
      displayInfo = ex.getMessage();
      if (displayInfo != null) displayInfo = RiskUtil.replaceAll(displayInfo, "\n", " ");
    }

    return " "
        + RiskUtil.RISK_VERSION
        + " (save: "
        + RiskGame.SAVE_VERSION
        + " network: "
        + RiskGame.NETWORK_VERSION
        + ") \n"
        + " "
        + "system:"
        + java.util.Locale.getDefault()
        + " current:"
        + resb.getLocale()
        + " \n"
        + " "
        + netInfo
        + " \n"
        + " "
        + getOSString()
        + " \n"
        + " "
        + cpu
        + " \n"
        + " "
        + UIManager.getLookAndFeel()
        + " \n"
        + " "
        + displayInfo
        + " \n"
        + " "
        + System.getProperty("java.vendor")
        + " \n"
        + " "
        + System.getProperty("java.vendor.url")
        + " \n"
        + " "
        + name
        + " \n"
        + " "
        + System.getProperty("java.vm.name")
        + " ("
        + System.getProperty("java.vm.version")
        + ", "
        + info
        + ") \n"
        + " "
        + System.getProperty("java.specification.version")
        + " ("
        + System.getProperty("java.version")
        + ") \n"
        + " "
        + home
        + " \n"
        + " "
        + System.getProperty("java.class.version");
  }