dTools' JConsole is a small library that alows Java developers to create console 'like' application quickly and easily.
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.
JConsole console = new JConsole( "Math Console" );
// 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 );
console.addCommand( new AddCommand() ); console.addCommand( new MultiplyCommand() ); console.addCommand( new DivideCommand() ); console.addCommand( new ListCommand() );
console.start();