Josh
Native console access wrapper for Java

com.yifanlu.Josh
Class JoshOutput

java.lang.Object
  extended by com.yifanlu.Josh.JoshBuffer
      extended by com.yifanlu.Josh.JoshOutput

public class JoshOutput
extends JoshBuffer

Provides simplified access to the output buffer. This is recommended for users who just want to change text colors and other popular console controls.
Objects from this class are immutable.

Since:
0.1
Version:
1.3, 05/29/10
Author:
Yifan Lu

Constructor Summary
JoshOutput(ConsoleHandle handle)
          Creates a new output buffer for simplified manipulation of the output buffer.
 
Method Summary
 void clearConsole()
          Clears the console buffer to a blank black screen.
 void clearConsole(ConsoleColor background)
          Clears the console buffer and sets the background color.
 void print(java.lang.String output)
          Print a string.
 void printcolorln(java.lang.Object... objects)
          Print a String with a foreground color and then change the character color back to defaults and terminate the line.
 void printhighlightln(java.lang.Object... objects)
          Print a String with a background color and then change the character color back to defaults and terminate the line.
 void println(java.lang.String output)
          Print a String and then terminate the line.
 
Methods inherited from class com.yifanlu.Josh.JoshBuffer
equals, getHandle, hashCode, setHandle
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoshOutput

public JoshOutput(ConsoleHandle handle)
Creates a new output buffer for simplified manipulation of the output buffer.

Parameters:
handle - A memory location that this buffer represents.
Method Detail

clearConsole

public void clearConsole()
Clears the console buffer to a blank black screen.


clearConsole

public void clearConsole(ConsoleColor background)
Clears the console buffer and sets the background color.

Parameters:
background - The background color of the console buffer.

println

public void println(java.lang.String output)
Print a String and then terminate the line.

Parameters:
output - The String to be printed.

print

public void print(java.lang.String output)
Print a string.

Parameters:
output - The String to be printed.

printhighlightln

public void printhighlightln(java.lang.Object... objects)
                      throws java.lang.IllegalArgumentException
Print a String with a background color and then change the character color back to defaults and terminate the line. Call the function like this: printhightln(ConsoleColor.BLUE(), "This is blue text", ConsoleColor.GREEN(), "This is green text"); Note that this method accepts unlimited number of paramaters and interprets it as an array or objects. The array MUST be in the order of ConsoleColor, then String.

Parameters:
objects - An array of Object in the order of ConsoleColor, then String in that order.
Throws:
java.lang.IllegalArgumentException - If the order of the paramaters is not correct.

printcolorln

public void printcolorln(java.lang.Object... objects)
                  throws java.lang.IllegalArgumentException
Print a String with a foreground color and then change the character color back to defaults and terminate the line. Call the function like this: printcolorln(ConsoleColor.BLUE(), "This is blue colored text", ConsoleColor.GREEN(), "This is green colored text"); Note that this method accepts unlimited number of paramaters and interprets it as an array or objects. The array MUST be in the order of ConsoleColor, then String.

Parameters:
objects - An array of Object in the order of ConsoleColor, then String in that order.
Throws:
java.lang.IllegalArgumentException - If the order of the paramaters is not correct.

Copyright © 2010 Yifan Lu