File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Serialization in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Serialization in JTable" Watch "Serialization in JTable" New topic
Author

Serialization in JTable

sirisha pu
Greenhorn

Joined: Nov 03, 2003
Posts: 9
hello,
I want to send the Object of JTable from servlet/ejb to an applet.Since JTable is serialized I should be able to do this.
But ToolTipManager which is not serialized is referenced somewhere in JTable or the TableModel ,so I get a notserialized exception.
If I try to serialize an object which has references of not serialized objects may be inner classes which I am not creating ,then how do I use them?
regards,
suchitra
Amit Zzz Kulkarni
Ranch Hand

Joined: Jul 05, 2000
Posts: 30
I don't know if you will get this post. But here goes.
There is no need to serialize JTable ,all data in the JTabel actually resides in the TableModel.Send across the raw data itself as it may reduce network traffic and help load up your Applet speedily.In applet populate teh TableModel with this data and then construct the JTable.
This Swing Component alongwith JTree is modeled in MVC (Model-View-Contoller) pattern. The Jtable is just a GUI display ,formally called as View ,whereas the TableModel either AbstractTableModel or DefaultTableModel is the Model.The controller is generally the user ;Either via a keyboard ,mouse or another component.
Another bit of advise always try to send across whole objects which are created by you ,whose composition you can control rather than tearing out your hair and trying to make somebody else's object hierarchy work for you.
I wrote a small piece of code (kept in a static method in a Utilities class which uses Reflection) which checks that each instance variable which is not a primitive is implementing serializable. Also in such a class all parameters passed thru methods should be checked at Compile-time itself. Shift the burden as much as possibel to the Compiler.
Feel free to ask me any question,mail me as I am not sure how this site works.
Cheers
Amit
Originally posted by suchitra:
hello,
I want to send the Object of JTable from servlet/ejb to an applet.Since JTable is serialized I should be able to do this.
But ToolTipManager which is not serialized is referenced somewhere in JTable or the TableModel ,so I get a notserialized exception.
If I try to serialize an object which has references of not serialized objects may be inner classes which I am not creating ,then how do I use them?
regards,
suchitra
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Serialization in JTable