home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1999 February / CDW0299.iso / Demos / Cafe / VCSAMPL.BIN / EmblazeClass.java < prev    next >
Encoding:
Java Source  |  1997-09-04  |  4.1 KB  |  172 lines

  1. /*
  2.     A basic extension of the java.awt.Frame class
  3.  */
  4.  
  5. import java.awt.*;
  6.  
  7. import geo.emblaze.*;
  8. public class EmblazeClass extends Frame
  9. {
  10.     public EmblazeClass()
  11.     {
  12.         // This code is automatically generated by Visual Cafe when you add
  13.         // components to the visual environment. It instantiates and initializes
  14.         // the components. To modify the code, only use code syntax that matches
  15.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  16.         // parse your Java file into its visual environment.
  17.         //{{INIT_CONTROLS
  18.         setLayout(null);
  19.         setVisible(false);
  20.         setSize(insets().left + insets().right + 600,insets().top + insets().bottom + 458);
  21.         setBackground(new Color(0));
  22.         emblaze201 = new geo.emblaze.Emblaze20();
  23.         try {
  24.             emblaze201.setFileURL(symantec.itools.net.RelativeURL.getURL("blaze/symantec.blz"));
  25.         }
  26.         catch (java.net.MalformedURLException error) { }
  27.         emblaze201.setBounds(insets().left + 27,insets().top + 23,543,339);
  28.         add(emblaze201);
  29.         button1 = new java.awt.Button();
  30.         button1.setActionCommand("button");
  31.         button1.setLabel("Close");
  32.         button1.setBounds(insets().left + 136,insets().top + 385,60,40);
  33.         add(button1);
  34.         button2 = new java.awt.Button();
  35.         button2.setActionCommand("button");
  36.         button2.setLabel("Start");
  37.         button2.setBounds(insets().left + 270,insets().top + 385,60,40);
  38.         add(button2);
  39.         button3 = new java.awt.Button();
  40.         button3.setActionCommand("button");
  41.         button3.setLabel("Pause");
  42.         button3.setBounds(insets().left + 404,insets().top + 385,60,40);
  43.         add(button3);
  44.         setTitle("Untitled");
  45.         //}}
  46.  
  47.         //{{INIT_MENUS
  48.         //}}
  49.  
  50.         //{{REGISTER_LISTENERS
  51.         SymWindow aSymWindow = new SymWindow();
  52.         this.addWindowListener(aSymWindow);
  53.         SymAction lSymAction = new SymAction();
  54.         button1.addActionListener(lSymAction);
  55.         button2.addActionListener(lSymAction);
  56.         button3.addActionListener(lSymAction);
  57.         //}}
  58.     }
  59.  
  60.     public EmblazeClass(String title)
  61.     {
  62.         this();
  63.         setTitle(title);
  64.     }
  65.  
  66.     public synchronized void show()
  67.     {
  68.         move(50, 50);
  69.         super.show();
  70.     }
  71.  
  72.     public void addNotify()
  73.     {
  74.         // Record the size of the window prior to calling parents addNotify.
  75.         Dimension d = getSize();
  76.         
  77.         super.addNotify();
  78.  
  79.         if (fComponentsAdjusted)
  80.             return;
  81.  
  82.         // Adjust components according to the insets
  83.         setSize(insets().left + insets().right + d.width, insets().top + insets().bottom + d.height);
  84.         Component components[] = getComponents();
  85.         for (int i = 0; i < components.length; i++)
  86.         {
  87.             Point p = components[i].getLocation();
  88.             p.translate(insets().left, insets().top);
  89.             components[i].setLocation(p);
  90.         }
  91.         fComponentsAdjusted = true;
  92.     }
  93.  
  94.     // Used for addNotify check.
  95.     boolean fComponentsAdjusted = false;
  96.  
  97.     //{{DECLARE_CONTROLS
  98.     geo.emblaze.Emblaze20 emblaze201;
  99.     java.awt.Button button1;
  100.     java.awt.Button button2;
  101.     java.awt.Button button3;
  102.     //}}
  103.  
  104.     //{{DECLARE_MENUS
  105.     //}}
  106.  
  107.     class SymWindow extends java.awt.event.WindowAdapter
  108.     {
  109.         public void windowClosing(java.awt.event.WindowEvent event)
  110.         {
  111.             Object object = event.getSource();
  112.             if (object == EmblazeClass.this)
  113.                 Frame1_WindowClosing(event);
  114.         }
  115.     }
  116.     
  117.     void Frame1_WindowClosing(java.awt.event.WindowEvent event)
  118.     {
  119.         hide();         // hide the Frame
  120.         dispose();
  121.     }
  122.  
  123.     class SymAction implements java.awt.event.ActionListener
  124.     {
  125.         public void actionPerformed(java.awt.event.ActionEvent event)
  126.         {
  127.             Object object = event.getSource();
  128.             if (object == button1)
  129.                 button1_Action(event);
  130.             else if (object == button2)
  131.                 button2_Action(event);
  132.             else if (object == button3)
  133.                 button3_Action(event);
  134.         }
  135.     }
  136.  
  137.     void button1_Action(java.awt.event.ActionEvent event)
  138.     {
  139.         // to do: code goes here.
  140.              
  141.         //{{CONNECTION
  142.         // Hide the Frame
  143.         setVisible(false);
  144.         dispose();
  145.         //}}
  146.     }
  147.  
  148.     void button2_Action(java.awt.event.ActionEvent event)
  149.     {
  150.         // to do: code goes here.
  151.              
  152.         //{{CONNECTION
  153.         // Start the animation
  154.         {
  155.             emblaze201.start();
  156.         }
  157.         //}}
  158.     }
  159.  
  160.     void button3_Action(java.awt.event.ActionEvent event)
  161.     {
  162.         // to do: code goes here.
  163.              
  164.         //{{CONNECTION
  165.         // Pause the animation
  166.         {
  167.             emblaze201.freeze();
  168.         }
  169.         //}}
  170.     }
  171. }
  172.