T
tiewknvc9
Hi,
Im trying to save a MyJTree class by serializing the class and of
course writing the output to a file.... but every time I try to save
it I get an error:
Exception in thread "AWT-EventQueue-0" java.lang.InternalError:
incorrect component
at javax.swing.plaf.basic.BasicTreeUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
any ideas? code follows....
when the saved button is pressed this happens:
---------------------------------------------
if (e.getActionCommand().equals("mniSave")){ //save the 'file'
try{
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream("C:\\test.txt"));
out.writeObject(m_tlTree);
out.flush();
out.close();
}catch (IOException ioe){
System.out.println("Failed to save");
}
-----------------------------------------
my jtree class implements serializable and has this code as writeobject
and readobject...
------------------------------------------------------------------------------------------
// --------- Serializable --------------
//for saving
private void writeObject(java.ibjectOutputStream out)
throws IOException {
out.defaultWriteObject();
}
private void readObject(java.ibjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
}
-----------------------------------------------------------------------------------------------
Im trying to save a MyJTree class by serializing the class and of
course writing the output to a file.... but every time I try to save
it I get an error:
Exception in thread "AWT-EventQueue-0" java.lang.InternalError:
incorrect component
at javax.swing.plaf.basic.BasicTreeUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
any ideas? code follows....
when the saved button is pressed this happens:
---------------------------------------------
if (e.getActionCommand().equals("mniSave")){ //save the 'file'
try{
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream("C:\\test.txt"));
out.writeObject(m_tlTree);
out.flush();
out.close();
}catch (IOException ioe){
System.out.println("Failed to save");
}
-----------------------------------------
my jtree class implements serializable and has this code as writeobject
and readobject...
------------------------------------------------------------------------------------------
// --------- Serializable --------------
//for saving
private void writeObject(java.ibjectOutputStream out)
throws IOException {
out.defaultWriteObject();
}
private void readObject(java.ibjectInputStream in)
throws IOException, ClassNotFoundException {
in.defaultReadObject();
}
-----------------------------------------------------------------------------------------------