If you encounter this problem in Netbeans, chances are you enabled the option “Compile on Save”. I do not know why this occurs because there are some cases where I enable this problem and I do not encounter the same error.
The sample data of the JTree when you drag it to your container always appear as color, sports and food. You cannot find this in the uneditable initComponents() method of the class file. Instead, go to the property list of the JTree class and do the following:
go to the “model” property and you will see a [TreeModel] value
click on the [TreeModel] to open a dialog
under the Tree Model Editor dropdown you will see the sample data below