I'm writing a simple console application (80x24) in Java, is there a gotoxy(x,y) equivalent?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Not without pulling in a console
curses
style library...You can try javacurses and see if that helps you.
I don't think there's a built-in function to do that in Java. There's a Java curses library called JCurses that you can use though.
If by gotoxy(x,y), you want to reposition your cursor somewhere specific on the console, you can usually use VT100 control codes to do this. See http://www.termsys.demon.co.uk/vtansi.htm.
Do something like
Which should move the cursor to position 10,10 on the console.
I found laterna to be a very good library. It does not dependend on any native library but runs 100% in pure Java.
It offers a
Screen
class which allows text output based on a coordinate system. For OS with a graphical environment it uses a Swing based terminal emulator. Unfortunately, you are not able to force terminal mode on Windows, so if you really need the terminal, use one of the solutions in the other answers.