I created a TextArea(50,80). I have wrote code to put the contents of a text file into the TextArea. Sometimes, there are over 300 lines in a file and the TextArea will scroll down to the end. Is there a way so after the file has been read, the TextArea will be at the beginning of the file (the first line of the TextArea) instead of the end?
FTPClient ftp = new FTPClient();
BufferedReader buffStream;
String inputLine;
String file;
String login = "root";
String password = "password";
ftp.connect("hostname");
ftp.login(login, password);
ftp.changeWorkingDirectory("/etc");
buffStream = new BufferedReader(new InputStreamReader(ftp.retrieveFileStream(file)));
resultFld.setText("");
while (null != (inputLine = buffStream.readLine())) {
resultFld.append(inputLine + "\n");
}
buffStream.close();
ftp.disconnect();