11th Apr 2020, 3:00 PM
Prabhat Ranjan
Prabhat Ranjan - avatar
6 Réponses
0
The correct answer would be by just typing System.out.println("\f");
13th Apr 2020, 9:35 AM
Prabhat Ranjan
Prabhat Ranjan - avatar
+ 2
Prabhat Ranjan Form feed char ("\f" or "\x0c") was initialy intended for printers... It's highly dependent on the target console / device: how it's handled will vary and some might ignore it, others print one or a few blank lines. For example, under my LMDE (Linux Mint Debian Edition) and python (2 & 3), print('\n',end='') output only one (almost empty) line (and doesn't simulate a cleared screen by printing enough lines to make the screen empty), as if I was printint a new line char ('\n') ^^ However, even if Form feed is working for you, that means that next prints will occurs at bottom of the screen, without reinitializing the cursor position to top left corner ;)
13th Apr 2020, 10:55 AM
visph
visph - avatar
+ 1
in CLI environments, use the ANSI escape code, and more precisely the CSI (Control Sequence Introduction): CSI J https://en.m.wikipedia.org/wiki/ANSI_escape_code in GUI environments, you must refer to your GUI framework documentation ^^
11th Apr 2020, 3:21 PM
visph
visph - avatar
+ 1
I guess that ncurses c-library should have a java binding: it's a useful library (tested with python) for handling advanced terminal output cross-platform/terminal: https://en.m.wikipedia.org/wiki/Ncurses That's not really a basic tool, but not really an obscure one: you need to deal with a relatively low-level API ;)
12th Apr 2020, 1:17 PM
visph
visph - avatar
0
No you are wrong
12th Apr 2020, 1:08 PM
Prabhat Ranjan
Prabhat Ranjan - avatar