java - JFrame serialisation with LookAndFeel -



java - JFrame serialisation with LookAndFeel -

i trying serialize jframe containing jdesktoppane several jinternalframes. encountered problem lookandfeel because reason not possible serialize swing component crossplatform lnf different one. wrote test programme in order figure out possibilites:

public static void main(string[] args) { seek { jframe f = new jframe(); f.setbounds(200,200,200,200); jtree tree = new jtree(); f.add(tree); f.setvisible(true); uimanager.setlookandfeel( uimanager.getcrossplatformlookandfeelclassname()); swingutilities.updatecomponenttreeui(f); objectoutputstream oop = new objectoutputstream( new fileoutputstream(new file("test.serialized"))); oop.writeobject(f); } catch(ioexception e) { e.printstacktrace(); } grab (classnotfoundexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (instantiationexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (illegalaccessexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (unsupportedlookandfeelexception e) { // todo auto-generated grab block e.printstacktrace(); } }

this didn't work 2 reasons:

i not able serialize frame , contained tree. tree fine when i set lookandfeel cross platform in first place , create tree afterwards.

any thought how prepare this?

edit: sorry making not clear: not trying serialize lnf or that. lnf doesnt want me serialize frame.

java.io.notserializableexception: com.apple.laf.aquatreeui

and on top of not able serialize frame contains tree.

exception in thread "awt-eventqueue-0" java.lang.internalerror: wrong component

check this. implementation proposed @sobolan.

java swing serialization look-and-feel

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -