home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / VCSAMPL.BIN / Calculate.java < prev    next >
Text File  |  1997-09-06  |  3KB  |  113 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.         GridBagLayout gridBagLayout;
  23.         gridBagLayout = new GridBagLayout();
  24.         setLayout(gridBagLayout);
  25.         setSize(262,144);
  26.         setBackground(new Color(16777215));
  27.         label1 = new java.awt.Label("Welcome to the Calculation Applet!");
  28.         label1.setBounds(29,12,204,23);
  29.         GridBagConstraints gbc;
  30.         gbc = new GridBagConstraints();
  31.         gbc.gridx = 0;
  32.         gbc.gridy = 0;
  33.         gbc.weightx = 1.0;
  34.         gbc.weighty = 1.0;
  35.         gbc.fill = GridBagConstraints.NONE;
  36.         gbc.insets = new Insets(0,0,0,0);
  37.         ((GridBagLayout)getLayout()).setConstraints(label1, gbc);
  38.         add(label1);
  39.         SimpleCalcButton = new java.awt.Button();
  40.         SimpleCalcButton.setActionCommand("button");
  41.         SimpleCalcButton.setLabel("Simple Calculations");
  42.         SimpleCalcButton.setBounds(68,60,125,23);
  43.         gbc = new GridBagConstraints();
  44.         gbc.gridx = 0;
  45.         gbc.gridy = 1;
  46.         gbc.weightx = 1.0;
  47.         gbc.weighty = 1.0;
  48.         gbc.fill = GridBagConstraints.NONE;
  49.         gbc.insets = new Insets(0,0,0,0);
  50.         ((GridBagLayout)getLayout()).setConstraints(SimpleCalcButton, gbc);
  51.         add(SimpleCalcButton);
  52.         LoanCalcButton = new java.awt.Button();
  53.         LoanCalcButton.setActionCommand("button");
  54.         LoanCalcButton.setLabel("Loan Calculations");
  55.         LoanCalcButton.setBounds(74,108,114,23);
  56.         gbc = new GridBagConstraints();
  57.         gbc.gridx = 0;
  58.         gbc.gridy = 2;
  59.         gbc.weightx = 1.0;
  60.         gbc.weighty = 1.0;
  61.         gbc.fill = GridBagConstraints.NONE;
  62.         gbc.insets = new Insets(0,0,0,0);
  63.         ((GridBagLayout)getLayout()).setConstraints(LoanCalcButton, gbc);
  64.         add(LoanCalcButton);
  65.         //}}
  66.     
  67.         //{{REGISTER_LISTENERS
  68.         Action lAction = new Action();
  69.         SimpleCalcButton.addActionListener(lAction);
  70.         LoanCalcButton.addActionListener(lAction);
  71.         //}}
  72.         
  73.         //setFocus(SimpleCalcButton);
  74.     }
  75.  
  76.     //{{DECLARE_CONTROLS
  77.     java.awt.Label label1;
  78.     java.awt.Button SimpleCalcButton;
  79.     java.awt.Button LoanCalcButton;
  80.     //}}
  81.  
  82.     class Action implements java.awt.event.ActionListener
  83.     {
  84.         public void actionPerformed(java.awt.event.ActionEvent event)
  85.         {
  86.             Object object = event.getSource();
  87.             if (object == SimpleCalcButton)
  88.                 SimpleCalcButton_Action(event);
  89.             else if (object == LoanCalcButton)
  90.                 LoanCalcButton_Action(event);
  91.         }
  92.     }
  93.  
  94.     void SimpleCalcButton_Action(java.awt.event.ActionEvent event)
  95.     {
  96.         // to do: code goes here.
  97.              
  98.         //{{CONNECTION
  99.         // Create and show the Frame
  100.         (new CalculateFrame()).show();
  101.         //}}
  102.     }
  103.  
  104.     void LoanCalcButton_Action(java.awt.event.ActionEvent event)
  105.     {
  106.         // to do: code goes here.
  107.              
  108.         //{{CONNECTION
  109.         // Create and show the Frame
  110.         (new LoanCalcFrame()).show();
  111.         //}}
  112.     }
  113. }