Console output changing in java

末鹿安然 提交于 2019-12-11 15:58:59

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!