• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How To Serialize Listeners

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

I am currently working on a project where I am trying to serialize an entire GUI on PC number 1 and restore that exact GUI on PC number 2.
Basically, I already have a prototype to store and restore the GUI, but how can I serialize the Listeners or how can I restore the exact functionality?
Hope,you can help me out!

Greetings,

Randy
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm assuming you mean objects that implement java.awt.EventListener. What makes the listeners different from the rest of the GUI? If you make the classes serializable, the listener objects will be serialized the same way a button or list box would be.
 
Randy Miller
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Greg!

That´s EXACTLY what I meant ;)
As far as I know and I tried this quite a lot these days, you can´t serialize Listeners and its functionality.The only way to serialize an object(GUI) so far(that´s what my "researching" says) implementing listeners is to use the key word "transient" in front of the listeners.But by using this key word,the listeners will be deleted and the buttons are practically dead after deserializing the GUI again.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Randy Miller wrote:HThe only way to serialize an object(GUI) so far(that´s what my "researching" says) implementing listeners is to use the key word "transient" in front of the listeners..



The keyword "transient" means that the field will not be serialized, so yea, that would deactivate the GUI.
I'd like to know how old the information your research found is. It used to be true that serialization of listeners was frowned upon because Swing was expected to change rapidly. Since you are exchanging listeners between two Java VM's presumably with the same version of AWT/Swing, I would assume it is possible to exchange listeners.
Personally, I think it makes more sense to serialize the GUI state, rather than each GUI object.
 
I don't like that guy. The tiny ad agrees with me.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic