I am writing a command-line applicat开发者_如何学编程ion 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?
The pragmatic solution is to use a progress bar instead. Something in the lines of System.out.print("-");
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.
精彩评论