home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JVISBRKR.Z / ApplicationFormPanel.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  26.3 KB  |  545 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20. //--------------------------------------------------------------------------------------------------
  21. // CORBA Reference Application
  22. // Copyright (c) 1997 by Borland International, All Rights Reserved
  23. //
  24. // Panel containing Credit Card Application
  25. //--------------------------------------------------------------------------------------------------
  26.  
  27. package borland.reference.creditapproval.client;
  28. import java.awt.*;
  29. import java.awt.event.*;
  30. import java.util.*;
  31. import java.text.*;
  32. import borland.jbcl.layout.*;
  33. import borland.jbcl.control.*;
  34. import borland.jbcl.dataset.*;
  35. import java.applet.*;
  36. import borland.reference.creditapproval.CORBAInterface.*;
  37.  
  38. /**
  39. * ApplicationFormPanel allows a user to enter application information and
  40. * to submit this information for Credit Card Approval.
  41. */
  42. public class ApplicationFormPanel extends BevelPanel implements Observer{
  43.   TableDataSet tableDataSetApplicantData = new TableDataSet();
  44.   TextFieldControl TextFieldControl0 = new TextFieldControl();
  45.   TextFieldControl TextFieldControl1 = new TextFieldControl();
  46.   TextFieldControl TextFieldControl2 = new TextFieldControl();
  47.   TextFieldControl TextFieldControl3 = new TextFieldControl();
  48.   TextFieldControl TextFieldControl4 = new TextFieldControl();
  49.   TextFieldControl TextFieldControl5 = new TextFieldControl();
  50.   TextFieldControl TextFieldControl6 = new TextFieldControl();
  51.   TextFieldControl TextFieldControl7 = new TextFieldControl();
  52.   TextFieldControl TextFieldControl8 = new TextFieldControl();
  53.   TextFieldControl TextFieldControl9 = new TextFieldControl();
  54.   TextFieldControl TextFieldControl10 = new TextFieldControl();
  55.   FieldControl FieldControl1 = new FieldControl();
  56.   FieldControl FieldControl2 = new FieldControl();
  57.   FieldControl FieldControl3 = new FieldControl();
  58.   Label label1 = new Label();
  59.   Label label2 = new Label();
  60.   Label label3 = new Label();
  61.   Label label4 = new Label();
  62.   Label label5 = new Label();
  63.   Label label6 = new Label();
  64.   Label label7 = new Label();
  65.   Label label8 = new Label();
  66.   Label label9 = new Label();
  67.   Label label10 = new Label();
  68.   Label label11 = new Label();
  69.   Label label12 = new Label();
  70.   Label label13 = new Label();
  71.   Label label14 = new Label();
  72.   Label label15 = new Label();
  73.   Column columnFirstName = new Column();
  74.   Column columnLastName = new Column();
  75.   Column columnMi = new Column();
  76.   Column columnAddr1 = new Column();
  77.   Column columnAddr2 = new Column();
  78.   Column columnCity = new Column();
  79.   Column columnState = new Column();
  80.   Column columnPostalCode = new Column();
  81.   Column columnCountry = new Column();
  82.   Column columnPhone = new Column();
  83.   Column columnIdentification = new Column();
  84.   Column columnDob = new Column();
  85.   Column columnMonthlyIncome = new Column();
  86.   Column columnRentMortgagePayment = new Column();
  87.   ImageControl imageControl1 = new ImageControl();
  88.   ButtonControl buttonSubmit = new ButtonControl();
  89.   ButtonControl buttonClear = new ButtonControl();
  90.   Label label16 = new Label();
  91.   private CreditApprovalApplet theApplet = null;
  92.   Message messageRequiredFieldMissing = new Message();
  93.   StatusBar statusBar = new StatusBar();
  94.   BevelPanel bevelPanel1 = new BevelPanel();
  95.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  96.   BevelPanel bevelPanel2 = new BevelPanel();
  97.   BevelPanel bevelPanel3 = new BevelPanel();
  98.   GridBagLayout gridBagLayout2 = new GridBagLayout();
  99.   BevelPanel bevelPanel4 = new BevelPanel();
  100.   GridBagLayout gridBagLayout3 = new GridBagLayout();
  101.   GridBagLayout gridBagLayout4 = new GridBagLayout();
  102.   GridBagLayout gridBagLayout5 = new GridBagLayout();
  103.   BevelPanel bevelPanel5 = new BevelPanel();
  104.   BevelPanel bevelPanel6 = new BevelPanel();
  105.   GridBagLayout gridBagLayout6 = new GridBagLayout();
  106.   BorderLayout borderLayout1 = new BorderLayout();
  107.   BorderLayout borderLayout2 = new BorderLayout();
  108.   BorderLayout borderLayout3 = new BorderLayout();
  109.   private EmptyStringNullListener formColumnListener = new EmptyStringNullListener();
  110.   ResourceBundle res = Res.getBundle("borland.reference.creditapproval.client.Res");
  111.  
  112.  
  113.   /**
  114.   /* Default constructor - placed here for the sake of JavaBean compliance
  115.   */
  116.   public ApplicationFormPanel() {
  117.     try {
  118.       jbInit();
  119.     }
  120.     catch (Exception e) {
  121.       e.printStackTrace();
  122.     }
  123.   }
  124.  
  125.   /**
  126.   * Construct the Panel by invoking jbInit()
  127.   */
  128.   public ApplicationFormPanel( CreditApprovalApplet creditApp ) {
  129.     theApplet = creditApp;
  130.  
  131.     // Register an interset in the Callback Class
  132.     theApplet.callbackControlThread.getCallback().addObserver( this );
  133.  
  134.     // Register with the Column Listener so that this class is notified
  135.     // whenever a column is changed
  136.     formColumnListener.addObserver( this );
  137.  
  138.     try {
  139.       jbInit();
  140.       tableDataSetApplicantData.open();
  141.       tableDataSetApplicantData.insertRow( true );
  142.     }
  143.     catch (Exception e) {
  144.       e.printStackTrace();
  145.     }
  146.     updateStatusWithNextRequired();
  147.   }
  148.  
  149.   /**
  150.   *  Initialize the Panel
  151.   */
  152.   private void jbInit() throws Exception{
  153.     this.setBevelInner(BevelPanel.FLAT);
  154.     this.setLayout(borderLayout3);
  155.     label1.setForeground(Color.red);
  156.     label1.setFont(new Font("Dialog", 3, 18));
  157.     label1.setAlignment(1);
  158.     label1.setText(res.getString("Credit_Card"));
  159.     label2.setFont(new Font("Dialog", 3, 14));
  160.     label2.setAlignment(1);
  161.     label2.setText(res.getString("Personal_Information"));
  162.     tableDataSetApplicantData.setStoreName("");
  163.     columnFirstName.setCaption(res.getString("First"));
  164.     columnFirstName.setColumnName("firstName");
  165.     columnFirstName.setEditMask("ccccccccccccccccccccccccc");
  166.     columnFirstName.setExportDisplayMask("");
  167.     columnFirstName.setDefault("");
  168.     columnFirstName.setDataType(borland.jbcl.util.Variant.STRING);
  169.     columnFirstName.setRequired(true);
  170.     TextFieldControl0.setColumnName("firstName");
  171.     TextFieldControl0.setDataSet(tableDataSetApplicantData);
  172.     columnLastName.setCaption(res.getString("Last"));
  173.     columnLastName.setColumnName("lastName");
  174.     columnLastName.setEditMask("cccccccccccccccccccccccccccccccccccccccc");
  175.     columnLastName.setRequired(true);
  176.     columnLastName.setDataType(borland.jbcl.util.Variant.STRING);
  177.     columnMi.setCaption(res.getString("MI"));
  178.     columnMi.setColumnName("mi");
  179.     columnMi.setDataType(borland.jbcl.util.Variant.STRING);
  180.     columnMi.setEditMask("c");
  181.     columnAddr2.setColumnName("addr2");
  182.     columnAddr2.setCaption(res.getString("Address_2"));
  183.     columnAddr2.setEditMask("cccccccccccccccccccccccccccccc");
  184.     columnAddr2.setDataType(borland.jbcl.util.Variant.STRING);
  185.     label3.setText(res.getString("Name") + ":" );
  186.     TextFieldControl1.setColumnName("mi");
  187.     TextFieldControl1.setDataSet(tableDataSetApplicantData);
  188.     TextFieldControl2.setColumnName("lastName");
  189.     TextFieldControl2.setDataSet(tableDataSetApplicantData);
  190.     label4.setText(res.getString("First"));
  191.     label5.setAlignment(1);
  192.     label5.setText(res.getString("MI"));
  193.     label6.setText(res.getString("Last"));
  194.     label7.setText(res.getString("Address_1") + ":");
  195.     label8.setText(res.getString("Address_2") + ":" );
  196.     label9.setText(res.getString("City") + "/" + res.getString("State") + "/" +
  197.                    res.getString("Postal_Code") + ":");
  198.     label10.setText(res.getString("Country") + ":");
  199.     label11.setText(res.getString("Phone") + ":");
  200.     label12.setText(res.getString("Personal_ID") + ":");
  201.     label13.setText(res.getString("DOB") + ":" );
  202.     label14.setText(res.getString("Monthly_Income") + ":");
  203.     label15.setText(res.getString("Rent_Mortgage_Payment") + ":");
  204.     TextFieldControl3.setColumnName("addr1");
  205.     TextFieldControl3.setDataSet(tableDataSetApplicantData);
  206.     TextFieldControl4.setColumnName("addr2");
  207.     TextFieldControl4.setDataSet(tableDataSetApplicantData);
  208.     TextFieldControl5.setColumnName("city");
  209.     TextFieldControl5.setDataSet(tableDataSetApplicantData);
  210.     TextFieldControl6.setColumnName("country");
  211.     TextFieldControl6.setDataSet(tableDataSetApplicantData);
  212.     TextFieldControl7.setColumnName("phone");
  213.     TextFieldControl7.setDataSet(tableDataSetApplicantData);
  214.     TextFieldControl8.setColumnName("identification");
  215.     TextFieldControl8.setDataSet(tableDataSetApplicantData);
  216.     FieldControl1.setColumnName("dob");
  217.     FieldControl1.setDataSet(tableDataSetApplicantData);
  218.     FieldControl2.setColumnName("monthlyIncome");
  219.     FieldControl2.setDataSet(tableDataSetApplicantData);
  220.     FieldControl3.setColumnName("rentMortgagePayment");
  221.     FieldControl3.setDataSet(tableDataSetApplicantData);
  222.     TextFieldControl9.setColumnName("state");
  223.     TextFieldControl9.setDataSet(tableDataSetApplicantData);
  224.     TextFieldControl10.setColumnName("postalCode");
  225.     TextFieldControl10.setDataSet(tableDataSetApplicantData);
  226.     columnCity.setColumnName("city");
  227.     columnCity.setCaption(res.getString("City"));
  228.     columnCity.setEditMask("cccccccccccccccccccccccccccccc");
  229.     columnCity.setDataType(borland.jbcl.util.Variant.STRING);
  230.     columnCity.setRequired(true);
  231.     columnRentMortgagePayment.setColumnName("rentMortgagePayment");
  232.     columnRentMortgagePayment.setCaption(res.getString("Rent_Mortgage_Payment"));
  233.     columnRentMortgagePayment.setDataType(borland.jbcl.util.Variant.DOUBLE);
  234.     columnRentMortgagePayment.setCurrency(true);
  235.     columnRentMortgagePayment.setRequired(true);
  236.     if (theApplet != null)
  237.       imageControl1.setImageURL( new java.net.URL(theApplet.getImageLocation() + "logo.gif"));
  238.     buttonClear.setLabel(res.getString("Clear"));
  239.     buttonClear.addActionListener(new ApplicationFormPanel_buttonClear_actionAdapter(this));
  240.     label16.setFont(new Font("Dialog", 3, 14));
  241.     label16.setAlignment(1);
  242.     label16.setText(res.getString("Financial_Information"));
  243.     messageRequiredFieldMissing.setResult(Message.OK);
  244.     messageRequiredFieldMissing.setTitle(res.getString("Required_Field"));
  245.     statusBar.setBevelOuter(BevelPanel.LOWERED);
  246.     bevelPanel4.setMargins(new Insets(2, 2, 2, 2));
  247.     bevelPanel6.setBevelInner(BevelPanel.FLAT);
  248.     bevelPanel6.setLayout(borderLayout1);
  249.     bevelPanel5.setLayout(gridBagLayout6);
  250.     bevelPanel2.setLayout(gridBagLayout5);
  251.     bevelPanel4.setLayout(gridBagLayout4);
  252.     bevelPanel3.setLayout(gridBagLayout2);
  253.     bevelPanel1.setLayout(gridBagLayout1);
  254.     statusBar.setBevelInner(BevelPanel.LOWERED);
  255.     statusBar.setDataSet(tableDataSetApplicantData);
  256.     buttonSubmit.setLabel(res.getString("Submit"));
  257.     buttonSubmit.addActionListener(new ApplicationFormPanel_buttonSubmit_actionAdapter(this));
  258.     columnMonthlyIncome.setColumnName("monthlyIncome");
  259.     columnMonthlyIncome.setCaption(res.getString("Monthly_Income"));
  260.     columnMonthlyIncome.setDataType(borland.jbcl.util.Variant.DOUBLE);
  261.     columnMonthlyIncome.setCurrency(true);
  262.     columnMonthlyIncome.setRequired(true);
  263.     columnDob.setColumnName("dob");
  264.     columnDob.setCaption(res.getString("DOB"));
  265.     columnDob.setDataType(borland.jbcl.util.Variant.DATE);
  266.     columnDob.setRequired(true);
  267.  
  268.     // Resourced, so a locale-specific edit mask is used
  269.     columnDob.setEditMask(res.getString("DobEditMask"));
  270.     // Not resourced, so US currency is alsways used
  271.     columnMonthlyIncome.setEditMask("$##,###.##");
  272.     columnRentMortgagePayment.setEditMask("$##,###.##");
  273.  
  274.     // Set to NULL so that LOCALE is used for edit mask
  275.     // columnDob.setEditMask( null );
  276.     // columnMonthlyIncome.setEditMask( null );
  277.     // columnRentMortgagePayment.setEditMask( null );
  278.  
  279.     columnIdentification.setColumnName("identification");
  280.     columnIdentification.setCaption(res.getString("Identification"));
  281.     columnIdentification.setEditMask("cccccccccccccccccccccccccccccc");
  282.     columnIdentification.setDataType(borland.jbcl.util.Variant.STRING);
  283.     columnPhone.setColumnName("phone");
  284.     columnPhone.setCaption(res.getString("Phone"));
  285.     columnPhone.setEditMask("ccccccccccccccc");
  286.     columnPhone.setRequired(true);
  287.     columnPhone.setDataType(borland.jbcl.util.Variant.STRING);
  288.     columnCountry.setColumnName("country");
  289.     columnCountry.setCaption(res.getString("Country"));
  290.     columnCountry.setEditMask("cccccccccccccccccccc");
  291.     columnCountry.setDataType(borland.jbcl.util.Variant.STRING);
  292.     columnCountry.setRequired(true);
  293.     columnPostalCode.setColumnName("postalCode");
  294.     columnPostalCode.setCaption(res.getString("Postal_Code"));
  295.     columnPostalCode.setEditMask("cccccccccccc");
  296.     columnPostalCode.setDataType(borland.jbcl.util.Variant.STRING);
  297.     columnPostalCode.setRequired(true);
  298.     columnState.setCaption(res.getString("State"));
  299.     columnState.setColumnName("state");
  300.     columnState.setEditMask("ccccccccccccccc");
  301.     columnState.setDataType(borland.jbcl.util.Variant.STRING);
  302.     columnState.setRequired(true);
  303.     columnAddr1.setCaption(res.getString("Address_1"));
  304.     columnAddr1.setColumnName("addr1");
  305.     columnAddr1.setDataType(borland.jbcl.util.Variant.STRING);
  306.     columnAddr1.setEditMask("cccccccccccccccccccccccccccccc");
  307.     columnAddr1.setRequired(true);
  308.     bevelPanel1.add(statusBar, new GridBagConstraints2(0, 1, 2, 1, 1.0, 1.0
  309.             ,GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(8, 4, 4, 4), 0, -5));
  310.     bevelPanel1.add(buttonSubmit, new GridBagConstraints2(0, 0, 1, 1, 1.0, 0.0
  311.             ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(8, 0, 0, 11), 11, 0));
  312.     bevelPanel1.add(buttonClear, new GridBagConstraints2(1, 0, 1, 1, 1.0, 0.0
  313.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 0, 0, 0), 22, 0));
  314.     this.add(bevelPanel1, BorderLayout.SOUTH);
  315.     this.add(bevelPanel3, BorderLayout.NORTH);
  316.     bevelPanel3.add(label1, new GridBagConstraints2(0, 0, 1, 1, 1.0, 1.0
  317.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  318.     this.add(bevelPanel4, BorderLayout.CENTER);
  319.     bevelPanel4.add(label2, new GridBagConstraints2(0, 0, 9, 1, 0.0, 0.0
  320.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 0, 0, 0), 0, 0));
  321.     bevelPanel4.add(TextFieldControl0, new GridBagConstraints2(4, 2, 1, 1, 1.0, 0.0
  322.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 61, 0));
  323.     bevelPanel4.add(TextFieldControl1, new GridBagConstraints2(5, 2, 2, 1, 0.0, 0.0
  324.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 4, 2), 0, 0));
  325.     bevelPanel4.add(TextFieldControl2, new GridBagConstraints2(7, 2, 2, 1, 1.0, 0.0
  326.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 120, 0));
  327.     bevelPanel4.add(TextFieldControl3, new GridBagConstraints2(4, 3, 5, 1, 0.0, 0.0
  328.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
  329.     bevelPanel4.add(TextFieldControl4, new GridBagConstraints2(4, 4, 5, 1, 0.0, 0.0
  330.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
  331.     bevelPanel4.add(TextFieldControl5, new GridBagConstraints2(4, 6, 1, 1, 0.0, 0.0
  332.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 0, 0));
  333.     bevelPanel4.add(TextFieldControl9, new GridBagConstraints2(5, 6, 2, 1, 1.0, 0.0
  334.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 2, 4, 2), 54, 0));
  335.     bevelPanel4.add(TextFieldControl10, new GridBagConstraints2(8, 6, 1, 1, 0.0, 0.0
  336.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
  337.     bevelPanel4.add(TextFieldControl6, new GridBagConstraints2(4, 7, 4, 1, 0.0, 0.0
  338.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
  339.     bevelPanel4.add(TextFieldControl7, new GridBagConstraints2(4, 8, 4, 1, 0.0, 0.0
  340.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
  341.     bevelPanel4.add(TextFieldControl8, new GridBagConstraints2(4, 9, 4, 1, 0.0, 0.0
  342.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 0), 77, 0));
  343.     bevelPanel4.add(FieldControl1, new GridBagConstraints2(4, 10, 1, 1, 0.0, 0.0
  344.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  345.     bevelPanel4.add(label3, new GridBagConstraints2(0, 2, 4, 1, 0.0, 0.0
  346.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 35, 0));
  347.     bevelPanel4.add(label4, new GridBagConstraints2(4, 1, 2, 1, 0.0, 0.0
  348.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 53, 0));
  349.     bevelPanel4.add(label5, new GridBagConstraints2(5, 1, 2, 1, 0.0, 0.0
  350.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  351.     bevelPanel4.add(label6, new GridBagConstraints2(7, 1, 2, 1, 0.0, 0.0
  352.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 59, 0));
  353.     bevelPanel4.add(label7, new GridBagConstraints2(0, 3, 4, 1, 0.0, 0.0
  354.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 14, 0, 0), 11, 0));
  355.     bevelPanel4.add(label8, new GridBagConstraints2(0, 4, 2, 2, 0.0, 0.0
  356.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 0, 0));
  357.     bevelPanel4.add(label9, new GridBagConstraints2(0, 6, 3, 1, 0.0, 0.0
  358.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), -6, 0));
  359.     bevelPanel4.add(label10, new GridBagConstraints2(0, 7, 2, 1, 0.0, 0.0
  360.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 18, 0));
  361.     bevelPanel4.add(label11, new GridBagConstraints2(0, 8, 2, 1, 0.0, 0.0
  362.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), 15, 0));
  363.     bevelPanel4.add(label12, new GridBagConstraints2(0, 9, 4, 1, 0.0, 0.0
  364.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 0, 0), -3, 0));
  365.     bevelPanel4.add(label13, new GridBagConstraints2(0, 10, 1, 1, 0.0, 0.0
  366.             ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 14, 11, 0), 0, 0));
  367.     this.add(bevelPanel6, BorderLayout.EAST);
  368.     bevelPanel6.add(bevelPanel2, BorderLayout.CENTER);
  369.     bevelPanel2.add(label16, new GridBagConstraints2(0, 0, 3, 1, 1.0, 0.0
  370.             ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(8, 0, 4, 0), 0, 0));
  371.     bevelPanel2.add(FieldControl2, new GridBagConstraints2(2, 1, 1, 1, 0.0, 0.0
  372.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
  373.     bevelPanel2.add(FieldControl3, new GridBagConstraints2(2, 2, 1, 1, 0.0, 0.0
  374.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 4, 4), 0, 0));
  375.     bevelPanel2.add(label14, new GridBagConstraints2(0, 1, 2, 1, 0.0, 0.0
  376.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 7, 0, 0), -10, 0));
  377.     bevelPanel2.add(label15, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0
  378.             ,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 7, 1, 0), 0, 0));
  379.     bevelPanel6.add(bevelPanel5, BorderLayout.NORTH);
  380.     bevelPanel5.add(imageControl1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  381.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 0, 0));
  382.  
  383.     // Add EmptyString = NULL Column Changed Listeners to all columns.
  384.     columnFirstName.addColumnChangeListener( formColumnListener );
  385.     columnLastName.addColumnChangeListener( formColumnListener );
  386.     columnMi.addColumnChangeListener( formColumnListener );
  387.     columnAddr1.addColumnChangeListener( formColumnListener );
  388.     columnAddr2.addColumnChangeListener( formColumnListener );
  389.     columnCity.addColumnChangeListener( formColumnListener );
  390.     columnState.addColumnChangeListener( formColumnListener );
  391.     columnPostalCode.addColumnChangeListener( formColumnListener );
  392.     columnCountry.addColumnChangeListener( formColumnListener );
  393.     columnPhone.addColumnChangeListener( formColumnListener );
  394.     columnIdentification.addColumnChangeListener( formColumnListener );
  395.     columnDob.addColumnChangeListener( formColumnListener );
  396.     columnMonthlyIncome.addColumnChangeListener( formColumnListener );
  397.     columnRentMortgagePayment.addColumnChangeListener( formColumnListener );
  398.  
  399.     tableDataSetApplicantData.setColumns(new Column[] {columnFirstName, columnLastName, columnMi, columnAddr1, columnAddr2, columnCity, columnState, columnPostalCode, columnCountry, columnPhone, columnIdentification, columnDob, columnMonthlyIncome, columnRentMortgagePayment});
  400.  
  401.   }
  402.  
  403.   /**
  404.   * Validate the user input - Make sure required fields have been
  405.   * completed.
  406.   */
  407.   boolean validateForm() {
  408.  
  409.     // Make sure the current control has processed Text back to
  410.     // the dataset by issuing a Focus Lost event
  411.     if (theApplet == null) return false;
  412.  
  413.     Component currentFocus = theApplet.browserFrame.getFocusOwner();
  414.     if (currentFocus != null)
  415.       if (currentFocus instanceof TextFieldControl)
  416.         currentFocus.dispatchEvent(new FocusEvent( currentFocus, FocusEvent.FOCUS_LOST, true ) );
  417.  
  418.     // Check for missing Required Columns
  419.     Column missingColumn = FindMissingRequired.missingColumn(tableDataSetApplicantData);
  420.     if (missingColumn != null ) {
  421.       messageRequiredFieldMissing.setMessage(res.getString("Please_enter_a_value") + " '" + missingColumn.getCaption() + "'");
  422.       messageRequiredFieldMissing.setFrame( theApplet.browserFrame );
  423.       messageRequiredFieldMissing.show();
  424.  
  425.       Component missing = FindMissingRequired.findColumnTextField( this, missingColumn.getColumnName());
  426.       if (missing != null) missing.requestFocus();
  427.       return false;
  428.     }
  429.     return true;
  430.   }
  431.  
  432.   /**
  433.   * The SUBMIT button was pressed:
  434.   * Submit the entered data to the Applet for Credit Approvals
  435.   */
  436.   void buttonSubmit_actionPerformed(ActionEvent ae) {
  437.  
  438.     if (!validateForm()) return;
  439.  
  440.     // Display the WAIT_CURSOR since this operation could take a moment
  441.     Cursor currentCursor = this.getCursor();
  442.     this.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR) );
  443.  
  444.     try {
  445.       applicantInfoStruct appInfo = new applicantInfoStruct();
  446.       creditApprovalStruct creditCardInfo;
  447.       appInfo.firstName = tableDataSetApplicantData.getString( "firstName" );
  448.       appInfo.MI = tableDataSetApplicantData.getString( "mi" );
  449.       appInfo.lastName = tableDataSetApplicantData.getString( "lastName" );
  450.       appInfo.DOB = tableDataSetApplicantData.getDate( "dob" ).toString();
  451.       appInfo.phone = tableDataSetApplicantData.getString( "phone" );
  452.       appInfo.address1 = tableDataSetApplicantData.getString( "addr1" );
  453.       appInfo.address2 = tableDataSetApplicantData.getString( "addr2" );
  454.       appInfo.city = tableDataSetApplicantData.getString( "city" );
  455.       appInfo.state = tableDataSetApplicantData.getString( "state" );
  456.       appInfo.postalCode = tableDataSetApplicantData.getString( "postalCode" );
  457.       appInfo.country = tableDataSetApplicantData.getString( "country" );
  458.       appInfo.PID = tableDataSetApplicantData.getString( "identification" );
  459.       appInfo.monthlyIncome = tableDataSetApplicantData.getDouble( "monthlyIncome" );
  460.       appInfo.rentMortgagePayment = tableDataSetApplicantData.getDouble( "rentMortgagePayment" );
  461.       theApplet.applyForCard( appInfo );
  462.     } catch (Exception e) {
  463.       System.err.println(e);
  464.     }
  465.  
  466.     // Restore the Cursor
  467.     this.setCursor( currentCursor );
  468.   }
  469.  
  470.   /**
  471.   *  The Clear button was pressed. Reset all columns to NULL
  472.   */
  473.   void buttonClear_actionPerformed(ActionEvent ae) {
  474.     try{
  475.       tableDataSetApplicantData.clearValues();
  476.       TextFieldControl0.requestFocus();
  477.     } catch( Exception e ) {
  478.       System.err.println(e);
  479.     }
  480.   }
  481.  
  482.   /**
  483.   *  Set the text in the status bar
  484.   */
  485.   private void setStatusText( String text ) {
  486.     statusBar.setText( text );
  487.   }
  488.  
  489.   /**
  490.   *  Find the next required column that does not contain a value and
  491.   * notify the user using the status bar.
  492.   */
  493.   private void updateStatusWithNextRequired() {
  494.     Column missingColumn = FindMissingRequired.missingColumn(tableDataSetApplicantData);
  495.     if (missingColumn != null )
  496.       setStatusText( res.getString("Please_enter_a_value") + " '" + missingColumn.getCaption() + "'");
  497.     else setStatusText( "" );
  498.   }
  499.  
  500.   /**
  501.   *  An obserable has changed. The only observables that this
  502.   * class observes is: 1) formColumnListener and
  503.   *                    2) the ClientCallback class
  504.   */
  505.   public void update( Observable obs, Object arg ) {
  506.     if ( obs instanceof ColumnChangeListener )
  507.       updateStatusWithNextRequired();
  508.     else if ( arg instanceof String )
  509.       setStatusText( (String) arg );
  510.   }
  511.  
  512. }
  513.  
  514. /**
  515. * ActionListner Class used for the Submit button
  516. */
  517. class ApplicationFormPanel_buttonSubmit_actionAdapter implements java.awt.event.ActionListener{
  518.   ApplicationFormPanel adaptee;
  519.  
  520.   ApplicationFormPanel_buttonSubmit_actionAdapter(ApplicationFormPanel adaptee) {
  521.     this.adaptee = adaptee;
  522.   }
  523.  
  524.   public void actionPerformed(ActionEvent e) {
  525.     adaptee.buttonSubmit_actionPerformed(e);
  526.   }
  527. }
  528.  
  529. /**
  530. * ActionListner Class used for the CLEAR button
  531. */
  532. class ApplicationFormPanel_buttonClear_actionAdapter implements java.awt.event.ActionListener{
  533.   ApplicationFormPanel adaptee;
  534.  
  535.   ApplicationFormPanel_buttonClear_actionAdapter(ApplicationFormPanel adaptee) {
  536.     this.adaptee = adaptee;
  537.   }
  538.  
  539.   public void actionPerformed(ActionEvent e) {
  540.     adaptee.buttonClear_actionPerformed(e);
  541.   }
  542. }
  543.  
  544.  
  545.