B
Brandon McCombs
Hello,
I'm trying to create a simple "notepad" type program. I'm reading a
text file and eventually I want to get the contents into the TextArea
widget except that I can't get the actual contents of the file for some
reason. I'm able to get the filename and path and it is marked as
available. I tried the Sun tutorial that is a simple app of the
following:
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
File inputFile = new File("in.txt");
File outputFile = new File("out.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
System.out.println(c);
out.write(c);
in.close();
out.close();
}
}
I've tried to implement the meat of that into my own app but I don't
know how to get the data that is coming out of read() into the TextArea
since its append() method requires a String.
Does anyone know how to make that type of a conversion?
thanks
I'm trying to create a simple "notepad" type program. I'm reading a
text file and eventually I want to get the contents into the TextArea
widget except that I can't get the actual contents of the file for some
reason. I'm able to get the filename and path and it is marked as
available. I tried the Sun tutorial that is a simple app of the
following:
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
File inputFile = new File("in.txt");
File outputFile = new File("out.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
System.out.println(c);
out.write(c);
in.close();
out.close();
}
}
I've tried to implement the meat of that into my own app but I don't
know how to get the data that is coming out of read() into the TextArea
since its append() method requires a String.
Does anyone know how to make that type of a conversion?
thanks