home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Sample.bin / Calculate.java < prev    next >
Text File  |  1998-11-08  |  3KB  |  101 lines

  1. /*
  2.     A basic extension of the java.applet.Applet class
  3.  */
  4.  
  5. import java.awt.*;
  6. import java.applet.*;
  7.  
  8. public class Calculate extends Applet
  9. {
  10.  
  11.     public void init()
  12.     {
  13.         // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
  14.         symantec.itools.lang.Context.setApplet(this);
  15.  
  16.         // This code is automatically generated by Visual Cafe when you add
  17.         // components to the visual environment. It instantiates and initializes
  18.         // the components. To modify the code, only use code syntax that matches
  19.         // what Visual Cafe can generate, or Visual Cafe may be unable to back
  20.         // parse your Java file into its visual environment.
  21.         //{{INIT_CONTROLS
  22.         setLayout(new GridBagLayout());
  23.         setBackground(java.awt.Color.white);
  24.         setSize(262,144);
  25.         label1.setText("Welcome to the Calculation Applet!");
  26.         add(label1,new com.symantec.itools.awt.GridBagConstraintsD(0,0,3,1,1.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.HORIZONTAL,new Insets(12,29,0,29),0,0));
  27.         label1.setBounds(29,12,204,23);
  28.         SimpleCalcButton.setActionCommand("button");
  29.         SimpleCalcButton.setLabel("Simple Calculations");
  30.         add(SimpleCalcButton,new com.symantec.itools.awt.GridBagConstraintsD(0,1,2,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(25,68,0,0),0,0));
  31.         SimpleCalcButton.setBounds(68,60,125,23);
  32.         LoanCalcButton.setActionCommand("button");
  33.         LoanCalcButton.setLabel("Loan Calculations");
  34.         add(LoanCalcButton,new com.symantec.itools.awt.GridBagConstraintsD(0,2,1,1,0.0,0.0,java.awt.GridBagConstraints.CENTER,java.awt.GridBagConstraints.NONE,new Insets(25,74,13,0),0,0));
  35.         LoanCalcButton.setBounds(74,108,114,23);
  36.         //}}
  37.     
  38.         //{{REGISTER_LISTENERS
  39.         
  40.         SymAction lSymAction = new SymAction();
  41.         SimpleCalcButton.addActionListener(lSymAction);
  42.         LoanCalcButton.addActionListener(lSymAction);
  43.         //}}
  44.         
  45.         
  46.     }
  47.  
  48.     //{{DECLARE_CONTROLS
  49.     java.awt.Label label1 = new java.awt.Label();
  50.     java.awt.Button SimpleCalcButton = new java.awt.Button();
  51.     java.awt.Button LoanCalcButton = new java.awt.Button();
  52.     //}}
  53.  
  54.     class SymAction implements java.awt.event.ActionListener
  55.     {
  56.         public void actionPerformed(java.awt.event.ActionEvent event)
  57.         {
  58.             Object object = event.getSource();
  59.             if (object == SimpleCalcButton)
  60.                 simpleCalcButton_ActionPerformed(event);
  61.             else if (object == LoanCalcButton)
  62.                 loanCalcButton_ActionPerformed(event);
  63.         }
  64.     }
  65.  
  66.     void simpleCalcButton_ActionPerformed(java.awt.event.ActionEvent event)
  67.     {
  68.         // to do: code goes here.
  69.              
  70.         simpleCalcButton_ActionPerformed_Interaction1(event);
  71.     }
  72.  
  73.  
  74.     void simpleCalcButton_ActionPerformed_Interaction1(java.awt.event.ActionEvent event)
  75.     {
  76.         try {
  77.             // CalculateFrame Create and show the CalculateFrame with a title
  78.             (new CalculateFrame("Simple Calculations")).setVisible(true);
  79.         } catch (Exception e) {
  80.         }
  81.     }
  82.  
  83.  
  84.     void loanCalcButton_ActionPerformed(java.awt.event.ActionEvent event)
  85.     {
  86.         // to do: code goes here.
  87.              
  88.         loanCalcButton_ActionPerformed_Interaction1(event);
  89.     }
  90.  
  91.  
  92.     void loanCalcButton_ActionPerformed_Interaction1(java.awt.event.ActionEvent event)
  93.     {
  94.         try {
  95.             // LoanCalcFrame Create and show the LoanCalcFrame with a title
  96.             (new LoanCalcFrame("Loan Calculations")).setVisible(true);
  97.         } catch (Exception e) {
  98.         }
  99.     }
  100.  
  101. }