[java code]public class XueJpanel extends JFrame {
private static final long serialVersionUID = 1L; private JPanel jpenter = new JPanel();
private JTextPane jtp = new JTextPane();
private JButton jbtx = new JButton("学历恶化");
private JButton jbtf = new JButton("fan化");
private JPanel jpbt = new JPanel();
private Container c = null;
public xueJpanel(){
jpbt.add(jbtx);
jpbt.add(jbtf);
jpenter.setBackground(Color.red);
jpenter.setPreferredSize(new Dimension(40,40));
jpenter.setSize(40,40);
jpenter.setLocation(70,70);
jtp.add(jpenter);
jtp.setEditable(true);
jbtx.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
System.out.println(jtp.getText());
File f = new File("d:\\s.dat");
doSave(f);
}

});
jbtf.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
File f = new File("d:\\s.dat");
doRead(f);
}

});
c = this.getContentPane();
c.setLayout(new BorderLayout());
c.add(new JScrollPane(jtp),BorderLayout.CENTER);
c.add(jpbt,BorderLayout.SOUTH);
this.setSize(800,700);
this.setLocation(50,50);
this.setVisible(true);
}

public static void main(String[] args){
new XueJpanel();
}

private void doSave(File file) {
FileOutputStream fous = null;
{
ObjectOutputStream oos = null;
try {
fous = new FileOutputStream(file);
oos = new ObjectOutputStream(fous);
oos.writeUnshared(jtp.getDocument());
oos.flush();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
fous.close();
} catch (IOException ex) {
ex.printStackTrace();
}
try {
oos.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}

private void doRead(File file) {
jtp.setText("");
FileInputStream fous = null;
{
ObjectInputStream ois = null;
try {
fous = new FileInputStream(file);
ois = new ObjectInputStream(fous);
jtp.setDocument((Document) ois.readUnshared());

if (jtp.getDocument() != null) {
System.out.println("ok"); }
// SwingUtilities.updateComponentTreeUI(text);
jtp.updateUI();
jtp.repaint();
this.repaint();
} catch (IOException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} finally {
try {
fous.close();
} catch (IOException ex) {
ex.printStackTrace();
}
try {
ois.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}

}
[/java code]为什么反序列化的时候 JPanel  显示不了 ,说明JPanel  jpenter   没有被序列化!
怎么才能序列化jpenter ????