问题
I am writing a console app in java. Is there a way to change certain lines in the console to new values so it looks a bit dynamic or even clear the whole screen?
The console I am using is the one in jcreator.
回答1:
You could try one of these
- http://javacurses.sourceforge.net/
- http://www.pitman.co.za/projects/charva/
回答2:
Once you print it out, you've lost control. If you want to be able to dynamically update it and do what you're trying to do, consider using a JTextPane (or whichever text component suits you best) as a custom console instead of the default console.
回答3:
I think the only thing you can do is print out new lines with the values you need on them. To clear the screen you would need to just print a bunch of blank lines.
来源:https://stackoverflow.com/questions/1535047/console-output-changing-in-java