In old-school C, this was done with a Unix library called Curses. So I did a google for Java curses library and got this link:
Stack Overflow Question
The other choice might be to use Swing to make it a GUI instead of a terminal program. But if you just want to work within the terminal window, this question points out several libraries that could help you.
Basically you need to send escape codes to the terminal window that tell the terminal what to do. Google VT100 escape codes as an example of what I mean, but your terminal window may not emulate a VT100 (an old, old text terminal from Digital Equipment Corp). So you can't just use VT100 escape sequences, as they might not be right. Instead, those libraries should look at your TERM environment variable and send the right escape sequences.
I have absolutely no idea if they'll work on Windows (if that's your environment). Good luck.