java - Not serializable exception File Chooser -


i have problem saving object output stream. reading there , tried make filechosser transient, ide says, not allowed here. classes implements serializable, don't know, problem. here error output:

java.io.notserializableexception: javax.swing.plaf.metal.metalfilechooserui @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1184) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1548) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1509) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.writeobject(objectoutputstream.java:348) @ javax.swing.event.eventlistenerlist.writeobject(eventlistenerlist.java:259) @ sun.reflect.generatedmethodaccessor8.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:1028) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1496) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1548) @ java.io.objectoutputstream.defaultwriteobject(objectoutputstream.java:441) @ javax.swing.jcomponent.writeobject(jcomponent.java:5515) @ sun.reflect.generatedmethodaccessor9.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:1028) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1496) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1548) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1509) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1548) @ java.io.objectoutputstream.defaultwriteobject(objectoutputstream.java:441) @ java.awt.window.writeobject(window.java:2937) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:1028) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1496) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.writeobject(objectoutputstream.java:348) @ java.awt.window.writeobject(window.java:2954) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:1028) @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1496) @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) @ java.io.objectoutputstream.writeobject(objectoutputstream.java:348) @ gui.chessboard.savegame(chessboard.java:288) @ gui.chessboard$4.mouseclicked(chessboard.java:348) @ java.awt.awteventmulticaster.mouseclicked(awteventmulticaster.java:270) @ java.awt.component.processmouseevent(component.java:6538) @ javax.swing.jcomponent.processmouseevent(jcomponent.java:3324) @ java.awt.component.processevent(component.java:6300) @ java.awt.container.processevent(container.java:2236) @ java.awt.component.dispatcheventimpl(component.java:4891) @ java.awt.container.dispatcheventimpl(container.java:2294) @ java.awt.component.dispatchevent(component.java:4713) @ java.awt.lightweightdispatcher.retargetmouseevent(container.java:4888) @ java.awt.lightweightdispatcher.processmouseevent(container.java:4534) @ java.awt.lightweightdispatcher.dispatchevent(container.java:4466) @ java.awt.container.dispatcheventimpl(container.java:2280) @ java.awt.window.dispatcheventimpl(window.java:2750) @ java.awt.component.dispatchevent(component.java:4713) @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:758) @ java.awt.eventqueue.access$500(eventqueue.java:97) @ java.awt.eventqueue$3.run(eventqueue.java:709) @ java.awt.eventqueue$3.run(eventqueue.java:703) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:86) @ java.awt.eventqueue$4.run(eventqueue.java:731) @ java.awt.eventqueue$4.run(eventqueue.java:729) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$javasecurityaccessimpl.dointersectionprivilege(protectiondomain.java:76) @ java.awt.eventqueue.dispatchevent(eventqueue.java:728) @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201) @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101) @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93) @ java.awt.eventdispatchthread.run(eventdispatchthread.java:82) 

code has @ least 20 classes, show method think problem is:

public void setlistenertosavebutton(jbutton savebutton) {      savebutton.addmouselistener(new mouseadapter() {         @override         public void mouseclicked(mouseevent e) {             super.mouseclicked(e);             jfilechooser chooser = new jfilechooser();             chooser.setselectedfile(new file("save.dat"));             int option = chooser.showsavedialog(contentpane);             if (option == jfilechooser.approve_option) {                 file file = chooser.getselectedfile();                 savegame(file);             }         }     }); } 

and here savegame method(chessboard.java:288):

public void savegame(file file) {     try {         objectoutputstream stream = new objectoutputstream(new fileoutputstream(file));         stream.writeobject(this); // line 288         stream.close();     } catch (exception ex) {         ex.printstacktrace();     } } 


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -