This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello Conrad, you are right, you can just give .setText a String, as the documentation says:
void setText(String t) Sets the text of this TextComponent to the specified text.
setText() is a method inherited from JTextComponent. There is method that's for you
void read(Reader in, Object desc) Initializes from a stream.
I was just working on this too, so here is a snippet of my code:
In my case, I had Textfiles with special characters (for instance: catalan and romanian characters), so I needed Unicode/ UTF-8 encoding. The important class to process the encoding information is InputStreamReader. If you don't need it like this, you are done with: