Building a Java text editor
jMenuItem1
).
actionPerformed()
event, and insert the following code into it:
// Handle the File|New menu item. // Clears the text of the text area. jTextArea1.setText("");
To handle that, you need to set up infrastructure for reading and writing text files, for tracking whether the file has changed and needs saving, and so on. Let's begin the file support in the next step.