// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.reflect.*;
import java.util.*;

public class ShowVersion extends Applet {
    private TextField tf1 = new TextField(60);
    private TextField tf2 = new TextField(60);
    private TextField tf3 = new TextField(60);

    //Initialize the applet
    public void init() {
        try {
            jbInit();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    //Component initialization
    private void jbInit() throws Exception {
        try {
           tf1.setText(System.getProperty("java.vm.vendor") + " " +
                       System.getProperty("java.vm.name") + " " +
                       System.getProperty("java.vm.version"));
        } catch(Exception e1) {
           tf1.setText("No privilegies to get java.vm.* system properties");
        }
        try {
           tf2.setText(System.getProperty("java.vendor") + " " +
                       System.getProperty("java.version"));
        } catch(Exception e2) {
           tf2.setText("No privilegies to get java.* system properties");
        }
        try {
           Class declarg[] = new Class[0];
           Method m = Class.forName("com.ms.util.SystemVersionManager").getMethod("getVMVersion", declarg);
           Object callarg[] = new Object[0];
           Properties vmver = (Properties)m.invoke(null, callarg);
           tf3.setText("Build " + vmver.getProperty("BuildIncrement"));
        } catch(Exception e3) {
           e3.printStackTrace();
           tf3.setText("No MS build version available");
        }
        add(tf1, null);
        add(tf2, null);
        add(tf3, null);
    }
    //Get Applet information
    public String getAppletInfo() {
        return "Show JVM version applet";
    }
    //Get parameter info
    public String[][] getParameterInfo() {
        return null;
    }
}
