Sandbox

From RogueBasin
(Difference between revisions)
Jump to: navigation, search
(GeShI is working!)
Line 2: Line 2:
  
 
Or like <math>E=mc^2</math>
 
Or like <math>E=mc^2</math>
 +
 +
Let's see
 +
<source lang="java">
 +
package net.slashie.libjcsi.examples;
 +
 +
import net.slashie.libjcsi.ConsoleSystemInterface;
 +
import net.slashie.libjcsi.wswing.WSwingConsoleInterface;
 +
 +
/**
 +
* This shows a basic output window using the Swing interface.
 +
* @author Santiago Zapata
 +
*/
 +
public class SCBExample {
 +
 +
    public static void main(String[] args) {
 +
        ConsoleSystemInterface csi = null;
 +
        try {
 +
            csi = new WSwingConsoleInterface("libjcsi example - Santiago Zapata", true);
 +
        } catch (ExceptionInInitializerError eiie) {
 +
            System.out.println("Fatal Error Initializing Swing Console Box");
 +
            eiie.printStackTrace();
 +
            System.exit(-1);
 +
        }
 +
        csi.cls();
 +
        csi.print(1, 1, "Hello, Hello!", ConsoleSystemInterface.CYAN);
 +
        csi.print(2, 3, "This is printed using the Java Console System Interface lib. (libjcsi)");
 +
        csi.print(2, 4, "Swing Console Box Implementation", ConsoleSystemInterface.RED);
 +
 +
        csi.print(5, 6, "########", ConsoleSystemInterface.GRAY);
 +
        csi.print(5, 7, "#......#", ConsoleSystemInterface.GRAY);
 +
        csi.print(5, 8, "#......#", ConsoleSystemInterface.GRAY);
 +
        csi.print(5, 9, "####/###", ConsoleSystemInterface.GRAY);
 +
 +
        csi.print(6, 7, "......", ConsoleSystemInterface.BLUE);
 +
        csi.print(6, 8, "......", ConsoleSystemInterface.BLUE);
 +
 +
        csi.print(9, 9, "/", ConsoleSystemInterface.BROWN);
 +
 +
        csi.print(8, 8, "@", ConsoleSystemInterface.RED);
 +
    }
 +
}
 +
 +
</source>
  
 
[[Roguelike Dev FAQ]]
 
[[Roguelike Dev FAQ]]

Revision as of 06:35, 16 January 2010

Wonder if mathematical formulas, like this $E=mc^2$ work here?

Or like <math>E=mc^2</math>

Let's see

package net.slashie.libjcsi.examples;
 
import net.slashie.libjcsi.ConsoleSystemInterface;
import net.slashie.libjcsi.wswing.WSwingConsoleInterface;
 
/**
 * This shows a basic output window using the Swing interface.
 * @author Santiago Zapata
 */
public class SCBExample {
 
    public static void main(String[] args) {
        ConsoleSystemInterface csi = null;
        try {
            csi = new WSwingConsoleInterface("libjcsi example - Santiago Zapata", true);
        } catch (ExceptionInInitializerError eiie) {
            System.out.println("Fatal Error Initializing Swing Console Box");
            eiie.printStackTrace();
            System.exit(-1);
        }
        csi.cls();
        csi.print(1, 1, "Hello, Hello!", ConsoleSystemInterface.CYAN);
        csi.print(2, 3, "This is printed using the Java Console System Interface lib. (libjcsi)");
        csi.print(2, 4, "Swing Console Box Implementation", ConsoleSystemInterface.RED);
 
        csi.print(5, 6, "########", ConsoleSystemInterface.GRAY);
        csi.print(5, 7, "#......#", ConsoleSystemInterface.GRAY);
        csi.print(5, 8, "#......#", ConsoleSystemInterface.GRAY);
        csi.print(5, 9, "####/###", ConsoleSystemInterface.GRAY);
 
        csi.print(6, 7, "......", ConsoleSystemInterface.BLUE);
        csi.print(6, 8, "......", ConsoleSystemInterface.BLUE);
 
        csi.print(9, 9, "/", ConsoleSystemInterface.BROWN);
 
        csi.print(8, 8, "@", ConsoleSystemInterface.RED);
    }
}

Roguelike Dev FAQ What a RL should be?

Personal tools