Not sure how to get an object to display after loading from ObjectInputStream()

Posted by Waylander on Stack Overflow See other posts from Stack Overflow or by Waylander
Published on 2010-06-14T01:01:57Z Indexed on 2010/06/14 1:12 UTC
Read the original article Hit count: 199

Filed under:
|
public void load()
{
    final JFileChooser fc = new JFileChooser();
    int returnVal = fc.showOpenDialog(this);
    if(returnVal == JFileChooser.APPROVE_OPTION)
    {
        try{
            FileInputStream f_in = new FileInputStream(fc.getSelectedFile());
            ObjectInputStream obj_in = new ObjectInputStream(f_in);
            Frame f2 = (Frame)obj_in.readObject();
            obj_in.close();
            f2.setVisible(true);
        }
        catch(Exception ex){
        }
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about streaming