fr = new Frame("Example8");
if (cmd.equals("save"))
{
ListeningPanel p = new ListeningPanel();
p.initialize();
fr.add(p);
fr.setVisible(true);
fr.reshape(100,100,300,100);
fr.repaint();
try
{
FileOutputStream f = new FileOutputStream("Example8.tmp");
ObjectOutput s = new ObjectOutputStream(f);
s.writeObject(p);
s.flush();
}
catch (Exception e)
{
System.out.println(e);
}
}
else if (cmd.equals("restore"))
{
try
{
FileInputStream f = new FileInputStream("Example8.tmp");
ObjectInput s = new ObjectInputStream(f);
ListeningPanel p = (ListeningPanel)s.readObject();
fr.add(p);
fr.setVisible(true);
fr.reshape(100,100,300,100);
fr.repaint();
}
catch (Exception e)
{
System.out.println(e);
}
}