Re: How does one find the terminal's width within the JVM?
- From: Tom Hawtin <usenet@xxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Apr 2007 12:19:17 +0100
Daniel Gee wrote:
Other than assuming it to be a standard 80x24 terminal, is there a
library call for it? The System class doesn't seem to have anything
for it, and the PrintStream class doesn't have anything on it either.
Am I just looking the wrong place?
If you are using an ANSI terminal emulator: The standard technique is to send the escape sequence to move to an absurdly large row and column position (<ESC>[999;999f) then query the cursor position (<ESC>[6n, which is responded to by <ESC>[{ROW};{COLUMN}R).
Telnet has command (NAWS) that reports changes in terminal sizes, but telnet commands are not available at the telnet stream level.
For Microsoft Windows console, I think in general you'd need native code.
Tom Hawtin
.
- References:
- How does one find the terminal's width within the JVM?
- From: Daniel Gee
- How does one find the terminal's width within the JVM?
- Prev by Date: Re: Is there a better way to do this?
- Next by Date: Re: How does one find the terminal's width within the JVM?
- Previous by thread: How does one find the terminal's width within the JVM?
- Next by thread: Re: How does one find the terminal's width within the JVM?
- Index(es):