The mouse is fun, but suppose we just want to put some text into a window. The authors' OutputBox class does the trick. Besides the obvious setTitle() method, it has several print() and println() methods that allow displaying information in an OutputBox window.
//File: Display.java
import CSLib.*;
public class Display
{
public static void main (String [] args)
{
OutputBox out = new
OutputBox("Testing");
out.println ("This is a test.");
out.println ("");
out.println ("The double space is
generated by the extra println statement.");
}
}

To make things more interactive, we explored the InputBox class. The following is a very simple example:
//File: Inbox.java
import CSLib.*;
public class Inbox
{
public static void main (String [] args)
{
InputBox in = new InputBox
("Some Input");
String whatever = in.readString();
}
}

Putting things together, we developed a truly interactive program:
//File: InOut.java
import CSLib.*;
public class InOut
{
public static void main (String [] args)
{
OutputBox out = new OutputBox
("Great huh?");
out.print ("What's your name? ");
out.print ("");
InputBox in = new InputBox();
String name = new String
(in.readString());
out.println (name);
out.println ("Have a nice day " +
name);
}
}



Before calling it a day, we began the exploration of the authors' DrawingBox class and had some fun drawing and filling circles. In this context, we used the Color class to add a little color to our creations.
//File: Circles.java
import java.awt.*; //This is where the Color class is
stored.
import CSLib.*; //This is where
the DrawingBox class is stored.
public class Circles
{
public static void main (String [] args)
{
DrawingBox box = new
DrawingBox ("This is fun!");
box.drawCircle (100, 100, 50);
box.fillCircle (200, 100, 25);
box.setColor (Color.RED);
box.fillCircle (250, 200, 50);
}
}
