Search code examples
javaconsole-applicationbukkit

How to make Java console App Like Bukkit (Show Log while keep cursor at bottom screen wait for input)


I want to create console app in Java like "Bukkit, Spigot" (https://i.sstatic.net/AXWq6.png)

As you can see in the pic, There are print log to the Console screen but how to keep cursor at bottom of screen (Keep the ">" sign bottom of screen and every input chars will started next to ">" sign and you can't delete ">" sign too!)

When I'm typing something in Console, and meanwhile there have a new line of log message, This thing always keep my input inline at bottom of screen (not split to somewhere else)

So how do I make something like this? I tried hard to search it from Google and didn't found solution for this :'(

Thank you in advance

Apidech T.

//Edit (add more details)

This thing like a chat client in console, Input and output are asynchronously and separated

//Solution The solution is Jline. Thank you


Solution

  • You need some library for terminal control that implements commands like "jump to line n, column m" or "erase to end of line" and so on. Have a look at What's a good Java, curses-like, library for terminal applications?.

    "curses" is a library that does the job for C/C++.