I'm writing a simple console application (80x24) in Java, is there a gotoxy(x,y) equivalent?
+5
A:
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.
Bill the Lizard
2009-06-16 13:04:59
+3
A:
Not without pulling in a console curses
style library...
You can try javacurses and see if that helps you.
John Weldon
2009-06-16 13:05:39
+4
A:
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
char escCode = 0x1B;
int row = 10; int column = 10;
System.out.print(String.format("%c[%d;%df",escCode,row,column));
Which should move the cursor to position 10,10 on the console.
Tom
2009-06-16 13:07:02