Hello I created some code to add draggable buttons to a JPanel. Every added button can be moved around once added to the JPanel. That is, when every you add a button you can now move it around. It saves and everything. However when you opened back a saved file the buttons cannot be moved. When the saved button appears back on the screen you cannot drag the buttons around again.. Can you help me please. Am really inexperinced in saving and opeing stuff. I tried reading tutorials on the net but its not a big help. Sorry for being a pest. Anyway here is the code.. and thanks for even looking at it... Yours respectfully Avin Sinanan.. here is the code..
HI Avin, Last time I seen this code you had a MoveableButton class and that was what you serialized. Serialization only saves an objects' state. What does that mean? It means that only class variables are saved. For AWT or Swing components that means that only things that can be set or get are serialized. Things that are added are not saved. Your problem is that you are thinking that the mouselistener that was added will be saved and brought back. That is not the case as you have probably observed. You will need to add the mouse listener once again to the buttons once you read them in and then it will work as you expect. Regards, Manfred.