Why Don't Key Listeners Work After Serializing?
posted 15 years ago
I have created a custom JTree that I wish to serialize and deserialize. I have managed to save the state of the nodes, and all it's relevant information, but all the key listeners that were added to the JTree before it gets serialized vanish after I read it back from the file (using an InputFileStream and InputObjectStream). The odd thing is that after I have successfully recreated the JTree, the key listeners that I add after that refuse to work. If I simply take out the code that reads in the object from the disk, and create the JTree normally, everything works. It's only after I read it back from the disk that the key listeners refuse to function, no matter how I try to add them or serialize them. I know I could save only the information necessary to create the JTree to disk (not the entire JTree) and then recreate it, but this is still bothering me...