M
martin1976
I'm trying to store a JList in a file. I got some code off the web for
loading one and that copiles, so I just changed all the outputs to
inputs and all the writes to reads in an attempt to read it back again.
Unfortunately the line objectIn.readObject(jList1) wont compile it says
"readObject in java.ibjectInputStream cannot be applied to
java.swing.JList"
JList implements Serialisable so I can't see what the problem is. Does
anybody know of another way of storing a jlist using serialization
public void readObjectFromFile(String FileName)
{
System.out.println("Serialising From Disk\n");
try
{
InputStream fileIn = new FileInputStream("test.txt");
try
{
ObjectInputStream objectIn = new ObjectInputStream(fileIn); }//... .. .. try
catch (Exception e)
{
System.out.println("exception occurred\n");
}//... .. .. catch (Exception e)
finally
{
fileIn.close();
}//... .. .. finally
}//... .. .. try
catch (IOException e)
{
e.printStackTrace();
}//... .. .. catch (IOException exc)
}//... .. .. public void readObjectFromFile(String FileName)
loading one and that copiles, so I just changed all the outputs to
inputs and all the writes to reads in an attempt to read it back again.
Unfortunately the line objectIn.readObject(jList1) wont compile it says
"readObject in java.ibjectInputStream cannot be applied to
java.swing.JList"
JList implements Serialisable so I can't see what the problem is. Does
anybody know of another way of storing a jlist using serialization
public void readObjectFromFile(String FileName)
{
System.out.println("Serialising From Disk\n");
try
{
InputStream fileIn = new FileInputStream("test.txt");
try
{
ObjectInputStream objectIn = new ObjectInputStream(fileIn); }//... .. .. try
catch (Exception e)
{
System.out.println("exception occurred\n");
}//... .. .. catch (Exception e)
finally
{
fileIn.close();
}//... .. .. finally
}//... .. .. try
catch (IOException e)
{
e.printStackTrace();
}//... .. .. catch (IOException exc)
}//... .. .. public void readObjectFromFile(String FileName)