/*
 * SystemProperties.java
 *
 * Created on May 30, 2001, 9:49 AM
 */


/**
 *
 * @author  Michael Thomas
 * @version 
 */

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class SystemProperties extends Applet {

  boolean blnApplet = false;
  
    /** Creates new SystemProperties */
    public SystemProperties() {
    }

    /**
    * @param args the command line arguments
    */
    public static void main (String args[]) {
      
    Frame app = new Frame( "System Properties" );  
    app.setSize( 640, 480);                         //set Frame: width, height

    app.addWindowListener(      //Register an anonymous class as a listener.
         new WindowAdapter() {
            public void windowClosing( WindowEvent e ) 
            {  
               System.exit( 0 );
            }
         }
    );

    final SystemProperties applet = new SystemProperties();         //create the applet.
    applet.init();                                //initialize applet.
    applet.start();                               //start applet.

    app.add( applet, BorderLayout.CENTER );       //add applet to center of frame.
    app.setVisible( true );                    //Make frame visible.

    }
    
    public void init() {
      
      try {
        Object objTestForApplet = this.getCodeBase();
        blnApplet = true;
      } catch ( Exception e ) {
        blnApplet = false;
      }

      
    }

  //--------------------------------------------------------------------------------------  
  public void paint(Graphics g) {
  //--------------------------------------------------------------------------------------  
  
    int intX, intY;
    int intXinc, intYinc;
    
    intX = 10;
    intY = 15;
    intXinc = 0;
    intYinc = 15;

    g.drawString("Properties: (Application or Applet)",intX += intXinc, intY += intYinc);
    g.drawString("file.separator = " + System.getProperty("file.separator"),intX += intXinc, intY += intYinc );
    g.drawString("line.separator (windows & unix platform) = " + "\\n",intX += intXinc, intY += intYinc  );
    g.drawString("line.separator (actual) = " + System.getProperty("line.separator"),intX += intXinc, intY += intYinc );
    g.drawString("path.separator = " + System.getProperty("path.separator"),intX += intXinc, intY += intYinc );
    g.drawString("java.class.version = " + System.getProperty("java.class.version"),intX += intXinc, intY += intYinc );
    g.drawString("java.vendor = " + System.getProperty("java.vendor"),intX += intXinc, intY += intYinc );
    g.drawString("java.vendor.url = " + System.getProperty("java.vendor.url"),intX += intXinc, intY += intYinc );
    g.drawString("java.version = " + System.getProperty("java.version"),intX += intXinc, intY += intYinc );
    g.drawString("os.arch = " + System.getProperty("os.arch"),intX += intXinc, intY += intYinc );
    g.drawString("os.name = " + System.getProperty("os.name"),intX += intXinc, intY += intYinc );
    g.drawString("os.version = " + System.getProperty("os.version"),intX += intXinc, intY += intYinc );

    if ( ! blnApplet ) {

      //Future, show additional system Properties.
      g.drawString("", intX += intXinc, intY += intYinc );
      g.drawString("Properties: (Applications only or Trusted Applets)", intX += intXinc, intY += intYinc );
      g.drawString("java.class.path = " + System.getProperty("java.class.path"), intX += intXinc, intY += intYinc );
      g.drawString("java.home = " + "|"+System.getProperty("java.home"), intX += intXinc, intY += intYinc );
      g.drawString("user.dir = " + System.getProperty("user.dir"), intX += intXinc, intY += intYinc );
      g.drawString("user.home = " + System.getProperty("user.home"), intX += intXinc, intY += intYinc );
      g.drawString("user.name = " + System.getProperty("user.name"), intX += intXinc, intY += intYinc );

    } else {
      g.drawString("", intX += intXinc, intY += intYinc );
      g.drawString("If this class was run as a Java application you would see additional properties.", intX += intXinc, intY += intYinc );      
    } 
    
  }
  
} //End of Class
//EOF

