krut.KRUT_GUI
Class OutputText

java.lang.Object
  extended by krut.KRUT_GUI.OutputText

public class OutputText
extends java.lang.Object

This class is a very simple output window. The out() method is used to print lines of text.


Field Summary
 boolean inited
          true if the output window is initiated, false if not.
 javax.swing.JFrame outFrame
          The frame for this window.
 javax.swing.JTextArea output
          The text area where the output is printed.
 
Constructor Summary
OutputText()
           
 
Method Summary
 void hold()
          Can be used to wait for this class to be ready to accept output.
 void init(int xPos, int yPos)
          Initiate the output window.
 void out(java.lang.String outString)
          Prints a line in the output window.
 void wakeUp()
          Wakes up users waiting for the OutputText to finish initializing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

output

public javax.swing.JTextArea output
The text area where the output is printed. This parameter is public in case there are parts of the program remaining that still print directly by adding to this output. Also, to print in that way would give more flexibility that the out() method offers.


outFrame

public javax.swing.JFrame outFrame
The frame for this window. This is public becaise Run_KRUT uses the setVisible() method of this class.


inited

public boolean inited
true if the output window is initiated, false if not. This parameter is changed at the end of the init method.

Constructor Detail

OutputText

public OutputText()
Method Detail

hold

public void hold()
Can be used to wait for this class to be ready to accept output. Users are woken when OutputText is ready. The inited flag must be checked in order to safely determine if OutputText is ready, upon return from this method.


wakeUp

public void wakeUp()
Wakes up users waiting for the OutputText to finish initializing. This method is called when OutputText is ready.


out

public void out(java.lang.String outString)
Prints a line in the output window. This method works the same way as System.out.println(), except for this output window.

Parameters:
outString - A string containg the line to be printed.

init

public void init(int xPos,
                 int yPos)
Initiate the output window. This method will set inited = true when the output window is initiated and ready to accept output.

Parameters:
xPos - The x position on the screen where the window should appear.
yPos - The y position on the screen where the window should appear.