"A Simple Task"
This week, in my programming-class, we got a new assignment. It's all probably very, very basic, but this is our first programming-class, so our skills are slightly rudimentary, but it is still too much to manage on our own. However, this wouldn't be a real problem, since it is a course where we are supposed to learn all this. BUT, to actually achieve higher grades, we are not allowed to ask our teacher for help or guidance. (which to me sounds completely insane, but there it is.) So, here I am, instead asking around on a forum. Of course, this is all concerning Java-programming.
Our assignment is as follows:
Simple Texteditor in Java
Your ask is to create a simple "singe-line texteditor". You may choose if the user should be asked for a file to be edited, or if you use a specifik filename in the code. The full content of the file shall be shown and then the user gets to input one, or several lines that will be added to the end of the file.
Hint: You will need to learn how to read and write text in files, in Java.
Suggestions on improvement:
- Ask the user for a filename in an ordinary input dialog, command line arguent, or a file requester.
- The possibiity for the user to, in some way, add and/or switch text anywhere in the file.
- GUI - program this to work wit ha GUI, more complicated, but more comprehensible and more appealing.
Note! Comment on the code often, so it is obvious that you understand the code.
Of course, it is not my intention that I want someone to do all this for me. It is just that I could need some help or guidance with it, maybe talk through some ideas or similar.
So far, I've understood that we're supposed to use the input/output command, but other then that, well...
Alright, that's about it, thanks for your time, and I hope I can get some help with this!
Re: "A Simple Task"
If I were you I'd use a JTextArea for the purpose; read the API documentation for that class and you know all.