dTools' JConsole

Welcome

dTools' JConsole is a small library that alows Java developers to create console 'like' application quickly and easily.

How To Use

JConsole is written so that it takes four steps to create a console. Below are the basic steps with example code taken from the JConsoleMathExample.java found in the repository.

  1. Create a new instance of JConsole
    JConsole console = new JConsole( "Math Console" );
    
  2. Add any shared objects to JConsole
    // Create a collection of variables (such as variables in algebra)
        Map<String,Double> variables = new TreeMap<String,Double>();
        
        variables.put( "a", new Double(0) );
        variables.put( "b", new Double(0) );
        variables.put( "c", new Double(0) );
        variables.put( "x", new Double(0) );
        variables.put( "y", new Double(0) );
        variables.put( "z", new Double(0) );
        
        console.addSharedObject( "variables", (Object) variables );
    
    // Create a collection of constants
    
        Map<String,Double> constants = new TreeMap<String,Double>();
        
        constants.put( "pi", Math.PI );
        constants.put( "e" , Math.E  );
        
        console.addSharedObject( "constants", (Object) constants );
    
  3. Add any custom commands
    console.addCommand( new AddCommand()      );
    console.addCommand( new MultiplyCommand() );
    console.addCommand( new DivideCommand()   );
    console.addCommand( new ListCommand()     );
    
  4. Start JConsole
    console.start();