FileDocCategorySizeDatePackage
Example8.javaAPI DocExample1651Tue Jun 03 23:35:32 BST 1997None

Example8

public class Example8 extends Object

Fields Summary
protected Frame
fr
Constructors Summary
Methods Summary
public voidinit(java.lang.String cmd)

      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);
        }
     }
   
public static voidmain(java.lang.String[] args)

      Example8 a = new Example8();
      a.init(args[0]);