home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 July & August / Pcwk78a98.iso / Internet / Javadraw / DATA.Z / bc.pre < prev    next >
Text File  |  1997-03-04  |  2KB  |  88 lines

  1. import java.awt.event.*;
  2. import java.awt.image.*;
  3. import java.io.ObjectOutputStream;
  4. import java.io.ObjectInputStream;
  5. import java.io.IOException;
  6. import java.net.URL;
  7.  
  8. public class \Name\ extends Container implements Runnable 
  9.    {
  10.    private int beanVersion = 0;
  11.    private int minimumWidth = 150;
  12.    private int minimumHeight = 100;
  13.    private java.awt.Color bgColor = java.awt.Color.white;
  14.    
  15.    public \Name\() 
  16.       {
  17.       init();
  18.       }
  19.  
  20.    public void init() 
  21.       {
  22.       initListeners();
  23.       super.setBackground (bgColor);
  24.       }
  25.       
  26.    private void initListeners()
  27.       {
  28.       }
  29.  
  30.    public void start(ActionEvent x) 
  31.       {
  32.       }
  33.  
  34.    public void stop(ActionEvent x) 
  35.       {
  36.       }
  37.    
  38.    public void paint(Graphics g) 
  39.       {
  40.       super.paint (g);
  41.       }
  42.  
  43.    public Dimension minimumSize() 
  44.       {
  45.       return new Dimension(minimumWidth, minimumHeight);
  46.       }
  47.    
  48.    public Dimension preferredSize() 
  49.       {
  50.       return minimumSize();
  51.       }
  52.  
  53.    public void run() 
  54.       {
  55.       }
  56.       
  57. // ************ Properties *************
  58.  
  59.    public synchronized void setEnabled(boolean x) 
  60.       {
  61.       super.setEnabled(x);
  62.       notify();
  63.       }
  64.  
  65. //insert properties get and set methods here.
  66.  
  67. // ************ Serialization *************
  68.             
  69.    private void writeObject(ObjectOutputStream s) throws IOException 
  70.       {
  71.       s.writeInt (beanVersion);
  72.       //write all necessary properties.
  73.       }
  74.    
  75.    
  76.    private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException 
  77.       {
  78.       if (s.readInt() != beanVersion) 
  79.          {
  80.          throw new IOException("\Name\.readObject: version mismatch.");
  81.          }
  82.       //read your properties in the same order they've been written.
  83.       init();
  84.       }
  85.       
  86.    }
  87.    
  88.