/* Autor:           Dipl.-Inf., Dipl.-Ing. (FH) Michael Wilhelm
   Firma:           HS Harz, FB AI
   Version:         1.1
   Ersterstellung:  22.04.2001
   Letzte Änderung: 28.01.2006

*/


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;


// Komplettes Dialogfenster mit allen Testbeispielen der Basis-Klasse

public class BspProperties extends JFrame {

//  JToolBar toolBar;
  JButton BnProperties = new JButton(); 

  //Frame konstruieren
  public BspProperties() {
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    this.setSize(new Dimension(500, 250));
    this.setTitle("Beispielprogramm für die Basis-Klasse");
    setGUI();
  }

  private void setGUI() {
    Container cp = this.getContentPane();
    this.getContentPane().setLayout( new FlowLayout() );

    BnProperties.setText("Properties");
    BnProperties.setToolTipText("Anzeige der Java-Spezifika (path, line separatror userhome");
    BnProperties.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        BnProperties_click();
      }
    });
    cp.add(BnProperties);
    // ----------------------------------------

  }  // setGUI




  public static void main(String[] args) {
    BspProperties frame = new BspProperties();
    Dimension frameSize = frame.getSize();
    frame.setVisible(true);  // show()
  }


  void BnProperties_click() {
    String sText = "FileSeparator: "+CBasis.getfileSeparator();
    sText += "\n" + "PathSeparator: "+CBasis.getpathSeparator();
    sText += "\n" + "LineSeparator: "+CBasis.getlineSeparator();
    sText += "\n" + "UserHome: "+CBasis.getuserHome();
    sText += "\n" + "Username: "+CBasis.getuserName();
    sText += "\n" + "UserDir: "+CBasis.getuserDir();

    sText += "\n" + "Temp: "+CBasis.getpathParam("java.io.tmpdir");
    sText += "\n" + "BS: "+CBasis.getpathParam("os.name");
    sText += "\n" + "BS-Version: "+CBasis.getpathParam("os.version");
    CBasis.Message("Properties",sText);    
  }
/*
java.version  	Java Runtime Environment version
java.vendor 	Java Runtime Environment vendor
java.vendor.url 	Java vendor URL
java.home 	Java installation directory
java.vm.specification.version 	Java Virtual Machine specification version
java.vm.specification.vendor 	Java Virtual Machine specification vendor
java.vm.specification.name 	Java Virtual Machine specification name
java.vm.version 	Java Virtual Machine implementation version
java.vm.vendor 	Java Virtual Machine implementation vendor
java.vm.name 	Java Virtual Machine implementation name
java.specification.version 	Java Runtime Environment specification version
java.specification.vendor 	Java Runtime Environment specification vendor
java.specification.name 	Java Runtime Environment specification name
java.class.version 	Java class format version number
java.class.path 	Java class path
java.library.path 	List of paths to search when loading libraries
java.compiler 	Name of JIT compiler to use
java.ext.dirs 	Path of extension directory or directories
os.arch 	Operating system architecture

*/


}  // BspBasis





  // --------------------------------------------------------------
  // --------------------------------------------------------------
  // --------------------------------------------------------------
  // --------------------------------------------------------------


class CProperties {

    // liefert  /  oder \
    public static String getfileSeparator() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("file.separator");  
        return sErg;
    }  // getfileSeparator

    // liefert  :
    public static String getpathSeparator() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("path.separator");
        return sErg;
    }  // getpathSeparator

    
    // liefert  \n  bzw. \r\n
    public static String getlineSeparator() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("line.separator");
        return sErg;
    }  // getlineSeparator


  	        
    // c:\einstellungen  oder /home
    public static String getuserHome() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("user.home");
        return sErg;
    }  // getuserHome
                

    
    public static String getuserName() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("user.name");
        return sErg;
    }  // getpathSeparator
                

     // aktuelle Verzeichnis
    public static String getuserDir() {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get("user.dir");
        return sErg;
    }  // getpathSeparator


    // liefert  alles
    public static String getpathParam(String sParam) {
        java.util.Properties pHash = System.getProperties();
        String sErg = (String) pHash.get(sParam);
        return sErg;
    }  // getpathParam




}  // CCProperties


