• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How to save properly?

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..



thanks
[ March 02, 2002: Message edited by: Avin Sinanan ]
[ March 02, 2002: Message edited by: Avin Sinanan ]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic