home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1998 February / VPR9802A.ISO / APP_DEMO / VC / SAMPLES.BIN / AnimatorClass.java < prev    next >
Text File  |  1997-10-27  |  4KB  |  131 lines

  1. /*
  2.     A basic extension of the java.applet.Applet class
  3.  */
  4.  
  5. import java.awt.*;
  6. import java.applet.*;
  7.  
  8. import symantec.itools.multimedia.Animator;
  9. import symantec.itools.awt.Label3D;
  10. import symantec.itools.awt.VerticalSlider;
  11. import symantec.itools.multimedia.*;
  12. import symantec.itools.awt.*;
  13. public class AnimatorClass extends Applet
  14. {
  15.  
  16.     public void init()
  17.     {
  18.         // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
  19.         symantec.itools.lang.Context.setApplet(this);
  20.  
  21.         // This code is automatically generated by Visual Cafe when you add
  22.         // components to the visual environment. It instantiates and initializes
  23.         // the components. To modify the code, only use code syntax that matches
  24.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  25.         // parse your Java file into its visual environment.
  26.         //{{INIT_CONTROLS
  27.         GridBagLayout gridBagLayout;
  28.         gridBagLayout = new GridBagLayout();
  29.         setLayout(gridBagLayout);
  30.         setSize(535,372);
  31.         setFont(new Font("Dialog", Font.PLAIN, 12));
  32.         setForeground(new Color(0));
  33.         setBackground(new Color(-19200));
  34.         animator1 = new symantec.itools.multimedia.Animator();
  35.         try {
  36.             java.net.URL[] tempURL = new java.net.URL[2];
  37.             tempURL[0] = symantec.itools.net.RelativeURL.getURL("1.gif");
  38.             tempURL[1] = symantec.itools.net.RelativeURL.getURL("10.gif");
  39.             animator1.setImageList(tempURL);
  40.         }
  41.         catch (java.net.MalformedURLException error) { }
  42.         catch(java.beans.PropertyVetoException e) { }
  43.         animator1.setBounds(91,4,353,86);
  44.         GridBagConstraints gbc;
  45.         gbc = new GridBagConstraints();
  46.         gbc.gridx = 0;
  47.         gbc.gridy = 0;
  48.         gbc.weightx = 1.0;
  49.         gbc.weighty = 1.0;
  50.         gbc.fill = GridBagConstraints.NONE;
  51.         gbc.insets = new Insets(0,0,0,0);
  52.         ((GridBagLayout)getLayout()).setConstraints(animator1, gbc);
  53.         add(animator1);
  54.         verticalSlider1 = new symantec.itools.awt.VerticalSlider();
  55.         try {
  56.             verticalSlider1.setMaxValue(200);
  57.         }
  58.         catch(java.beans.PropertyVetoException e) { }
  59.         try {
  60.             verticalSlider1.setTickFreq(10);
  61.         }
  62.         catch(java.beans.PropertyVetoException e) { }
  63.         verticalSlider1.setBounds(0,94,535,184);
  64.         gbc = new GridBagConstraints();
  65.         gbc.gridx = 0;
  66.         gbc.gridy = 1;
  67.         gbc.weightx = 1.0;
  68.         gbc.weighty = 1.0;
  69.         gbc.fill = GridBagConstraints.BOTH;
  70.         gbc.insets = new Insets(0,0,0,0);
  71.         ((GridBagLayout)getLayout()).setConstraints(verticalSlider1, gbc);
  72.         add(verticalSlider1);
  73.         label3D1 = new symantec.itools.awt.Label3D();
  74.         try {
  75.             label3D1.setText("Visual Cafe");
  76.         }
  77.         catch(java.beans.PropertyVetoException e) { }
  78.         try {
  79.             label3D1.setBorderIndent(symantec.itools.awt.Label3D.INDENT_TWO);
  80.         }
  81.         catch(java.beans.PropertyVetoException e) { }
  82.         label3D1.setBounds(0,278,535,93);
  83.         label3D1.setFont(new Font("TimesRoman", Font.PLAIN, 64));
  84.         gbc = new GridBagConstraints();
  85.         gbc.gridx = 0;
  86.         gbc.gridy = 2;
  87.         gbc.weightx = 1.0;
  88.         gbc.weighty = 1.0;
  89.         gbc.fill = GridBagConstraints.BOTH;
  90.         gbc.insets = new Insets(0,0,0,0);
  91.         ((GridBagLayout)getLayout()).setConstraints(label3D1, gbc);
  92.         add(label3D1);
  93.         //}}
  94.     
  95.         //{{REGISTER_LISTENERS
  96.         Action lAction = new Action();
  97.         verticalSlider1.addActionListener(lAction);
  98.         //}}
  99.     }
  100.  
  101.     //{{DECLARE_CONTROLS
  102.     symantec.itools.multimedia.Animator animator1;
  103.     symantec.itools.awt.VerticalSlider verticalSlider1;
  104.     symantec.itools.awt.Label3D label3D1;
  105.     //}}
  106.  
  107.     class Action implements java.awt.event.ActionListener
  108.     {
  109.         public void actionPerformed(java.awt.event.ActionEvent event)
  110.         {
  111.             Object object = event.getSource();
  112.             if (object == verticalSlider1)
  113.                 verticalSlider1_actionPerformed(event);
  114.         }
  115.     }
  116.  
  117.     void verticalSlider1_actionPerformed(java.awt.event.ActionEvent event)
  118.     {
  119.         // to do: code goes here.
  120.              
  121.         //{{CONNECTION
  122.         // Set the delay amount... Get the current value of the VerticalSlider
  123.         {
  124.             try {
  125.                 animator1.setDelay(verticalSlider1.getValue());
  126.             }
  127.             catch(java.beans.PropertyVetoException e) { }
  128.         }
  129.         //}}
  130.     }
  131. }