Search code examples
javatext-based

text base programs in java


i want to create a terminal application in java, but i don't know how to replace text lines that are already printed (kind of "edit the lines that already printed"). \r only returns to the beginning of the last line, and i want to display a 2 dimensional grid. this is a sample for what i want to print:

System.out.println("################");
System.out.println("#--------------#");
System.out.println("#--------------#");
System.out.println("################");


System.out.println("\r################");
System.out.println("#-------X------#");
System.out.println("#--------------#");
System.out.println("################");

Solution

  • you should try JLine library. It provides many userful functions for command line applications. http://jline.sourceforge.net/javadoc/