So question is how do you get all this information? For example if you are not does it make sense to "prettify" your code? probably not. Once you've written a program such that you can give it any string that will display properly on those assumptions (that terminal is 80 characters wide) you can now start worrying about what happens if you are connected to a terminal which is more or less than 80 characters? Or whether or not you are even connected to a terminal. How would you center a string on an 80 character wide terminal screen?ĭo you need to worry about the length of the string? How do you position something horizontally? Do you add spaces? Is there a format string you can come up with? So as a first step start with the assumption that it's 80 characters wide. So some hints for you:įirst question is, how wide is the terminal? (it's counted in number of characters) old terminals had a fixed dimensions of 80 characters and 25 lines It is a newbie question :) but it's a valid question. Read below it's in there.īefore you do though let's answer your entire question in some context You can use the JavaCurses library to do fun things on the console.
0 Comments
Leave a Reply. |