Netbeans 和 DOS 风格的进度条
我正在编写一个命令行应用程序,它通过打印类似“%d%%complete\r”的内容来显示其进度,因此光标到达同一行的开头,而不是下一行。 但是当我在 Netbeans 中运行它时,输出窗口不像 DOS 那样工作,并且我会在其中看到大量进度状态消息。有没有办法将光标移回 Netbeans 输出窗口中的同一行?
I am writing a command-line application which shows its progress by printing something like "%d%% complete\r", so the cursor gets to the beginning of the same line, not the next one.
But when I run it in Netbeans, output window does not work like DOS one and I get a flood of progress status messages into there. Is there a way to move a cursor back to the same line in Netbeans output window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
务实的解决方案是使用进度条。
System.out.print("-"); 行中的某些内容
The pragmatic solution is to use a progress bar instead.
Something in the lines of System.out.print("-");
Netbeans 输出窗口只是一个 Swing 组件。它不是终端窗口,您会注意到您的 Java 应用程序也没有控制台。 Netbeans 确实提供了 beta 终端窗口(窗口 -> 输出 -> 终端),但您需要手动键入正确的命令行才能通过它运行您的程序。
Netbeans output window is just a Swing component. It is not a terminal window, and you will notice that your Java app does not have a Console either. Netbeans does offer a beta Terminal window thing (Window -> Output -> Terminal) but you will need to type the proper commandlines manually to run your program through that.