Basic text editor in java