home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / DBServ / SAMPLES / SAMPLES.ZIP / Employees / EMPLOYEE.JAVA < prev    next >
Encoding:
Text File  |  1997-02-21  |  23.8 KB  |  572 lines

  1. /**************************************************************************************************
  2. *                                                                                                 *
  3. *                                                                                                 *
  4. *                                                                                                 *
  5. *  Class name:  Employee                                                                          *
  6. *     Purpose:  This application accesses the employee table and demonstrates basic database      *
  7. *               navigation and functionality (e.g., Add Save, First, Next).                       *
  8. *                                                                                                 *
  9. *     Imports:  java.awt.*                                                                        *
  10. *               symjava.applet.*                                                                  *
  11. *               dbFunction                                                                        *
  12. *                                                                                                 *
  13. *  Methods include: public class Employee                                                         *
  14. *                   public void init()                                                            *
  15. *                   public boolean handleEvent(Event)                                             *
  16. *                   public void start()                                                           *
  17. *                   public boolean keyDown(Event, int)                                            *
  18. *                   void tab(Event)                                                               *
  19. *                   int tabindex(Component, boolean)                                              *
  20. *                   public void resetControls(TextField[], Checkbox[], Button[], String)          *
  21. *                   public void selChangeDeptNames(Event)                                         *
  22. *                                                                                                 *
  23. *    Additional documentation for the database table can be seen in Employee.txt.  To read this   *
  24. *    information, just open the file Employee.txt in the Cafe' editor.                            *
  25. *                                                                                                 *
  26. * Additional Notes:                                                                               *
  27. * THIS SOFTWARE HAS BEEN COMPILED AND EXECUTED SUCCESSFULLY IN SPECIFIC SYMANTEC                  *
  28. * ENVIRONMENTS, AND IS BEING PROVIDED ONLY AS SAMPLE CODE.                                        *
  29. *                                                                                                 *
  30. * SYMANTEC MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE,          *
  31. * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF               *
  32. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.  SYMANTEC SHALL NOT     *
  33. * BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING *
  34. * THIS SOFTWARE OR ITS DERIVATIVES.                                                               *
  35. *                                                                                                 *
  36. *  Please see the Sample Code Configuration item in the Read Me file for additional               *
  37. *  information about the sample database used in this applet.                                     *
  38. *                                                                                                 *
  39. * Copyright (c) 1996 Symantec.  All Rights Reserved.                                              *
  40. *                                                                                                 *
  41. ***************************************************************************************************/
  42.  
  43. import java.awt.*;
  44. import java.applet.*;
  45. import dbFunctions;
  46.  
  47. public class Employee extends Applet {
  48.     String sstatusBarMessage = new String();
  49.  
  50. //  Global variables...
  51.     TextField[] gtfList;
  52.     Button[] gbList;
  53.     TextField gtfStatusBar;
  54.     List[] glList;
  55.     Checkbox[] gcbList;
  56.     String gsempId = new String();
  57.  
  58. //  Screen components...
  59.     Label Applet_Title;
  60.     Label label_emp_fname;
  61.     Label label_emp_lname;
  62.     Label label_birth_date;
  63.     TextField tf_emp_fname;
  64.     TextField tf_emp_lname;
  65.     TextField tf_street;
  66.     Label label_street;
  67.     Label label_city;
  68.     TextField tf_city;
  69.     Label label_state;
  70.     Label label_zip;
  71.     TextField tf_zip;
  72.     Label label_emp_id;
  73.     TextField tf_emp_id;
  74.     TextField tf_birth_date;
  75.     Label label_phone;
  76.     TextField tf_phone;
  77.     TextField tf_ss_number;
  78.     Label label_ss_number;
  79.     Label label_status;
  80.     Label label_sex;
  81.     TextField tf_sex;
  82.     Label label_salary;
  83.     TextField tf_salary;
  84.     Label label_start_date;
  85.     Label label_termination_date;
  86.     Label label_insurance;
  87.     Checkbox cb_health;
  88.     Checkbox cb_life;
  89.     Checkbox cb_dc;
  90.     Label label_dept_name;
  91.     List l_dept_names;
  92.     Label label_manager;
  93.     List l_manager_names;
  94.     TextField tf_start_date;
  95.     TextField tf_termination_date;
  96.     Button button_first;
  97.     Button button_next;
  98.     Button button_last;
  99.     Button button_search;
  100.     Button button_update;
  101.     TextField tf_state;
  102.     Button button_new_insert;
  103.     Button button_save;
  104.     Button button_all;
  105.     Button button_Quit;
  106.     TextField tf_status;
  107.     TextField Status_Bar;
  108.  
  109. //  Supporting class instantiation
  110.     dbFunctions db;
  111.  
  112.     public void init() {
  113.  
  114.         super.init();
  115.  
  116.         setLayout(null);
  117.         resize(819,484);
  118.  
  119.         Applet_Title=new Label("Employee Information", Label.CENTER);
  120.         Applet_Title.setFont(new Font("Dialog",Font.BOLD,18));
  121.         add(Applet_Title);
  122.         Applet_Title.reshape(298,8,252,30);
  123.  
  124.         label_emp_id=new Label("Employee #:");
  125.         add(label_emp_id);
  126.         label_emp_id.reshape(37,49,84,15);
  127.         tf_emp_id=new TextField(7);
  128.         add(tf_emp_id);
  129.         tf_emp_id.reshape(130,45,61,23);
  130.  
  131.         label_emp_lname=new Label("Last Name:");
  132.         label_emp_lname.setFont(new Font("Dialog",Font.PLAIN,10));
  133.         add(label_emp_lname);
  134.         label_emp_lname.reshape(42,83,88,15);
  135.         tf_emp_lname=new TextField(22);
  136.         add(tf_emp_lname);
  137.         tf_emp_lname.reshape(130,79,182,22);
  138.  
  139.         label_emp_fname=new Label("First Name:");
  140.         label_emp_fname.setFont(new Font("Dialog",Font.PLAIN,10));
  141.         add(label_emp_fname);
  142.         label_emp_fname.reshape(327,83,77,15);
  143.         tf_emp_fname=new TextField(22);
  144.         add(tf_emp_fname);
  145.         tf_emp_fname.reshape(417,79,182,22);
  146.  
  147.         label_street=new Label("Street Address:");
  148.         label_street.setFont(new Font("Dialog",Font.PLAIN,10));
  149.         add(label_street);
  150.         label_street.reshape(18,116,105,15);
  151.         tf_street=new TextField(25);
  152.         add(tf_street);
  153.         tf_street.reshape(130,113,210,22);
  154.  
  155.         label_city=new Label("City:");
  156.         label_city.setFont(new Font("Dialog",Font.PLAIN,10));
  157.         add(label_city);
  158.         label_city.reshape(364,116,39,15);
  159.         tf_city=new TextField(20);
  160.         add(tf_city);
  161.         tf_city.reshape(417,113,168,22);
  162.  
  163.         label_state=new Label("State:");
  164.         label_state.setFont(new Font("Dialog",Font.PLAIN,10));
  165.         add(label_state);
  166.         label_state.reshape(599,116,49,15);
  167.         tf_state=new TextField(4);
  168.         add(tf_state);
  169.         tf_state.reshape(651,113,40,20);
  170.  
  171.         label_zip=new Label("Zip:");
  172.         label_zip.setFont(new Font("Dialog",Font.PLAIN,10));
  173.         add(label_zip);
  174.         label_zip.reshape(695,116,35,15);
  175.         tf_zip=new TextField(9);
  176.         add(tf_zip);
  177.         tf_zip.reshape(733,113,79,22);
  178.  
  179.         label_phone=new Label("Phone #:");
  180.         label_phone.setFont(new Font("Dialog",Font.PLAIN,10));
  181.         add(label_phone);
  182.         label_phone.reshape(53,150,70,15);
  183.         tf_phone=new TextField(13);
  184.         add(tf_phone);
  185.         tf_phone.reshape(130,146,112,23);
  186.  
  187.         label_ss_number=new Label("SSN#:");
  188.         label_ss_number.setFont(new Font("Dialog",Font.PLAIN,10));
  189.         add(label_ss_number);
  190.         label_ss_number.reshape(354,150,52,15);
  191.         tf_ss_number=new TextField(13);
  192.         add(tf_ss_number);
  193.         tf_ss_number.reshape(417,146,113,23);
  194.  
  195.         label_status=new Label("Status:");
  196.         label_status.setFont(new Font("Dialog",Font.PLAIN,10));
  197.         add(label_status);
  198.         label_status.reshape(67,188,56,15);
  199.         tf_status=new TextField(3);
  200.         add(tf_status);
  201.         tf_status.reshape(130,191,30,23);
  202.  
  203.         label_sex=new Label("Sex:");
  204.         label_sex.setFont(new Font("Dialog",Font.PLAIN,10));
  205.         add(label_sex);
  206.         label_sex.reshape(273,188,37,15);
  207.         tf_sex=new TextField(3);
  208.         add(tf_sex);
  209.         tf_sex.reshape(315,191,30,23);
  210.  
  211.         label_birth_date=new Label("Date of Birth:");
  212.         label_birth_date.setFont(new Font("Dialog",Font.PLAIN,10));
  213.         add(label_birth_date);
  214.         label_birth_date.reshape(410,191,91,15);
  215.         label_birth_date.hide();
  216.         tf_birth_date=new TextField(9);
  217.         add(tf_birth_date);
  218.         tf_birth_date.reshape(511,191,81,23);
  219.         tf_birth_date.hide();
  220.  
  221.         label_start_date=new Label("Start Date:");
  222.         label_start_date.setFont(new Font("Dialog",Font.PLAIN,10));
  223.         add(label_start_date);
  224.         label_start_date.reshape(49,229,81,15);
  225.         tf_start_date=new TextField(9);
  226.         add(tf_start_date);
  227.         tf_start_date.reshape(130,229,77,22);
  228.  
  229.         label_termination_date=new Label("Termination Date:");
  230.         label_termination_date.setFont(new Font("Dialog",Font.PLAIN,10));
  231.         add(label_termination_date);
  232.         label_termination_date.reshape(242,233,115,15);
  233.         tf_termination_date=new TextField(9);
  234.         add(tf_termination_date);
  235.         tf_termination_date.reshape(364,233,77,22);
  236.  
  237.         label_salary=new Label("Salary:");
  238.         label_salary.setFont(new Font("Dialog",Font.PLAIN,10));
  239.         add(label_salary);
  240.         label_salary.reshape(480,233,54,15);
  241.         tf_salary=new TextField(9);
  242.         add(tf_salary);
  243.         tf_salary.reshape(539,233,77,23);
  244.  
  245.         label_insurance=new Label("Insurances:");
  246.         add(label_insurance);
  247.         label_insurance.reshape(639,236,80,15);
  248.         cb_health=new Checkbox("Heath");
  249.         cb_health.setFont(new Font("Dialog",Font.PLAIN,10));
  250.         add(cb_health);
  251.         cb_health.reshape(728,236,84,19);
  252.         cb_life=new Checkbox("Life");
  253.         cb_life.setFont(new Font("Dialog",Font.PLAIN,10));
  254.         add(cb_life);
  255.         cb_life.reshape(728,259,84,18);
  256.         cb_dc=new Checkbox("Day Care");
  257.         cb_dc.setFont(new Font("Dialog",Font.PLAIN,10));
  258.         add(cb_dc);
  259.         cb_dc.reshape(728,281,84,19);
  260.  
  261.         label_dept_name=new Label("Department:");
  262.         label_dept_name.setFont(new Font("Dialog",Font.PLAIN,10));
  263.         add(label_dept_name);
  264.         label_dept_name.reshape(106,271,74,15);
  265.         l_dept_names=new List();
  266.         add(l_dept_names);
  267.         l_dept_names.resize(l_dept_names.preferredSize(5));
  268.         l_dept_names.move(190,271);
  269.  
  270.         label_manager=new Label("Manager:");
  271.         label_manager.setFont(new Font("Dialog",Font.PLAIN,10));
  272.         add(label_manager);
  273.         label_manager.reshape(466,271,64,15);
  274.         l_manager_names=new List();
  275.         add(l_manager_names);
  276.         l_manager_names.resize(l_manager_names.preferredSize(2));
  277.         l_manager_names.move(538,271);
  278.  
  279.         button_first=new Button("<<");
  280.         add(button_first);
  281.         button_first.reshape(187,362,88,22);
  282.         button_first.disable();
  283.         button_next=new Button(">");
  284.         add(button_next);
  285.         button_next.reshape(292,362,88,22);
  286.         button_last=new Button(">>");
  287.         add(button_last);
  288.         button_last.reshape(397,362,88,22);
  289.         button_all=new Button("All");
  290.         add(button_all);
  291.         button_all.reshape(502,362,88,22);
  292.         button_search=new Button("Search");
  293.         add(button_search);
  294.         button_search.reshape(607,362,88,22);
  295.         button_new_insert=new Button("New");
  296.         add(button_new_insert);
  297.         button_new_insert.reshape(292,398,88,22);
  298.         button_update=new Button("Update");
  299.         add(button_update);
  300.         button_update.reshape(397,398,88,22);
  301.         button_Quit=new Button("Quit");
  302.         add(button_Quit);
  303.         button_Quit.reshape(502,398,88,22);
  304.  
  305.         Status_Bar=new TextField(96);
  306.         add(Status_Bar);
  307.         Status_Bar.reshape(12,439,795,26);
  308.         Status_Bar.setText("Connecting to database engine....One moment please....");
  309.  
  310.  
  311. //  Additional form properties....
  312.         setBackground(Color.lightGray);
  313.         tf_emp_id.setEditable(false);
  314.         cb_health.setBackground(Color.lightGray);
  315.         cb_life.setBackground(Color.lightGray);
  316.         cb_dc.setBackground(Color.lightGray);
  317.         Status_Bar.setEditable(false);
  318.         Status_Bar.setBackground(Color.green);
  319.         TextField[] tfList = {tf_emp_id, tf_emp_lname, tf_emp_fname, tf_street, tf_city, tf_state, tf_zip,
  320.                                tf_phone, tf_ss_number, tf_status, tf_sex, tf_salary, tf_start_date,
  321.                                tf_termination_date, tf_birth_date};
  322.         Checkbox[] cbList = {cb_health, cb_life, cb_dc};
  323.         Button[] bList = {button_first, button_next, button_last, button_all, button_search, button_new_insert, button_update,
  324.                                button_Quit};
  325.         TextField tfStatusBar = Status_Bar;
  326.         List[] lList = {l_dept_names, l_manager_names};
  327.  
  328.         gtfList = tfList;
  329.         glList = lList;
  330.         gbList = bList;
  331.         gtfStatusBar = tfStatusBar;
  332.         gcbList = cbList;
  333.  
  334.         show();
  335.         db = new dbFunctions();
  336. //  Fill in screen with data...
  337.         if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  338.             System.out.println("Failure displaying first record!");
  339.     }
  340.  
  341.     public boolean handleEvent(Event event) {
  342.         if (event.id == Event.LIST_SELECT && event.target == l_dept_names) {
  343.                 selChangeDeptNames(event);
  344.         }
  345.         else if (event.target == button_next) {
  346.             if (!button_first.isEnabled())
  347.                 button_first.enable();
  348.             if (!db.nextRecord(db.grsemployee))
  349.                 System.out.println("Failure navigating to next record!");
  350.             else {
  351.                 db.gicurrentRecord++;
  352.                 if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  353.                     System.out.println("Failure displaying next record!");
  354.                 if (db.gicurrentRecord == db.girecordCount) {
  355.                     button_next.disable();
  356.                     button_last.disable();
  357.                     Status_Bar.setBackground(Color.red);
  358.                 }
  359.                 else if ((db.girecordCount - db.gicurrentRecord) == 1)
  360.                         Status_Bar.setBackground(Color.yellow);
  361.             }
  362.         }
  363.         else if (event.target == button_last) {
  364.             button_first.enable();
  365.             button_last.disable();
  366.             button_next.disable();
  367.             if (!db.goLastRecord(db.gssearchClause, db.gsand))
  368.                 System.out.println("Failure navigating to last record!");
  369.             else {
  370.                 if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  371.                     System.out.println("Failure displaying next record!");
  372.                 Status_Bar.setBackground(Color.red);
  373.             }
  374.         }
  375.         else if (event.target == button_first) {
  376.             if (!button_next.isEnabled())
  377.                 button_next.enable();
  378.             button_first.disable();
  379.             button_last.enable();
  380.             if (!db.goFirstRecord(db.gssearchClause, db.gswhere, db.gsand))
  381.                 System.out.println("Failed retrieving first record on button_first ");
  382.             else {
  383.                 if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  384.                     System.out.println("Failure displaying first record!");
  385.                 if ((db.girecordCount - db.gicurrentRecord) == 1)
  386.                     Status_Bar.setBackground(Color.yellow);
  387.                 else
  388.                     Status_Bar.setBackground(Color.green);
  389.             }
  390.         }
  391.         else if (event.target == button_all) {
  392.             db.gssearchClause = "";
  393.             db.gswhere = "";
  394.             db.gsand = "";
  395.             button_last.enable();
  396.             button_first.disable();
  397.             if (!db.goFirstRecord(db.gssearchClause, db.gswhere, db.gsand))
  398.                 System.out.println("Failed retrieving first record on button_all");
  399.             else {
  400.                 if (!button_next.isEnabled())
  401.                     button_next.enable();
  402.                 if (!button_first.isEnabled())
  403.                     button_next.enable();
  404.                 if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  405.                     System.out.println("Failure displaying first record!");
  406.                 if (db.gicurrentRecord == db.girecordCount) {
  407.                     button_next.disable();
  408.                     Status_Bar.setBackground(Color.red);
  409.                 }
  410.                 else if ((db.girecordCount - db.gicurrentRecord) == 1)
  411.                         Status_Bar.setBackground(Color.yellow);
  412.                 else
  413.                     Status_Bar.setBackground(Color.green);
  414.             }
  415.         }
  416.         else if (event.target == button_search) {
  417.             if (!db.gbexecuteSearch)
  418.                 db.gotoRecord(gtfList, gcbList, glList, gbList);
  419.             else {
  420.                 db.gotoRecord(gtfList, gcbList, glList, gbList);
  421.                 if (db.girecordCount == 0) {
  422.                     Status_Bar.setText("Search retrieved 0 records!");
  423.                     Status_Bar.setBackground(Color.red);
  424.                     tf_emp_lname.requestFocus();
  425.                 }
  426.                 if (!db.populateScreen(gtfList, gcbList, glList, gtfStatusBar))
  427.                     System.out.println("Failure displaying search record!");
  428.                 if (db.gicurrentRecord == db.girecordCount) {
  429.                     button_next.disable();
  430.                     button_last.disable();
  431.                     Status_Bar.setBackground(Color.red);
  432.                 }
  433.                 else if ((db.girecordCount - db.gicurrentRecord) == 1)
  434.                     Status_Bar.setBackground(Color.yellow);
  435.                 else
  436.                     Status_Bar.setBackground(Color.green);
  437.                 button_first.disable();
  438.             }
  439.         }
  440.         else if (event.target == button_update) {
  441.                 db.gbInsert = false;
  442.                 int irowsUpdated = db.updateRecord(gtfList, gcbList, glList);
  443.                 Status_Bar.setText(irowsUpdated + " record(s) modified!");
  444.         }
  445.         else if (event.target == button_new_insert) {
  446.             if (button_new_insert.getLabel().equals("New")) {
  447.                 gsempId = db.getNextID();
  448.                 if (!gsempId.equals(null)) {
  449.                     resetControls(gtfList, gcbList, gbList, gsempId);
  450.                     Status_Bar.setBackground(Color.blue);
  451.                     Status_Bar.setText("New record");
  452.                 }
  453.                 else
  454.                     System.out.println("Error retrieving new ID!");
  455.  
  456.             }
  457.             else {
  458.                 int irowsInserted = db.insertNewValues(gtfList, gcbList, glList, gbList);
  459.                 if (irowsInserted == 0) {
  460.                     Status_Bar.setBackground(Color.red);
  461.                     Status_Bar.setText("Record not inserted!  Review entered data.");
  462.                 }
  463.                 else {
  464.                     button_last.disable();
  465.                     button_next.disable();
  466.                     Status_Bar.setBackground(Color.red);
  467.                     Status_Bar.setText("Record " + db.gicurrentRecord + " of " + db.girecordCount);
  468.                 }
  469.             }
  470.         }
  471.         return super.handleEvent(event);
  472.     }
  473.  
  474. //  Methods for adding tab control....
  475.     public void start() {
  476.         tf_emp_id.requestFocus();
  477.     }
  478.  
  479.     public boolean keyDown(Event evt, int key) {
  480.         if ((key==9) || (key==10)) {
  481.             tab(evt);
  482.             return true;
  483.         }
  484.         else return super.keyDown(evt, key);
  485.     }
  486.  
  487.     void tab(Event evt) {
  488.         Component temp = (Component)evt.target;
  489.         boolean shiftpressed=evt.shiftDown();
  490.  
  491.         int index = tabindex(temp, shiftpressed);
  492.         Component newtab = temp.getParent().getComponent(index);
  493.         newtab.requestFocus();
  494.         if (newtab instanceof TextField)
  495.             ((TextField)newtab).selectAll();
  496.     }
  497.  
  498.     int tabindex(Component current, boolean shiftpressed) {  //Returns the tab index of the next component
  499.         Component[] temp;
  500.         temp = current.getParent().getComponents();
  501.         int increment;
  502.         boolean foundit=false;
  503.  
  504.         if (!(shiftpressed))
  505.         {
  506.             increment=1;
  507.             for (int i=0;i<(temp.length)-1;i++)
  508.             {
  509.              if (current == temp[i]) foundit=true;
  510.              if (foundit)
  511.              {
  512.                  Component next=temp[i+increment];
  513.                  if ((next instanceof TextComponent) || (next instanceof Choice) || (next instanceof Button) || (next instanceof List))
  514.                       return (i+increment);
  515.                  else if (next instanceof Checkbox)
  516.                       {
  517.                         Checkbox tempcheckbox=(Checkbox)next;
  518.                        if (tempcheckbox.getCheckboxGroup()==null) return (i+increment);
  519.                       }
  520.               }
  521.             }
  522.         }
  523.         else
  524.         {
  525.             increment=-1;
  526.             for (int i=(temp.length)-1;i>=1;i--) {
  527.              if (current == temp[i]) foundit=true;
  528.              if (foundit)
  529.               {
  530.                  Component next=temp[i+increment];
  531.                  if ((next instanceof TextComponent) || (next instanceof Choice) || (next instanceof Button) || (next instanceof List))
  532.                       return (i+increment);
  533.                  else if (next instanceof Checkbox)
  534.                       {
  535.                         Checkbox tempcheckbox=(Checkbox)next;
  536.                        if (tempcheckbox.getCheckboxGroup()==null) return (i+increment);
  537.                       }
  538.               }
  539.             }
  540.         }
  541.         if (shiftpressed) {return (temp.length)-1;} else return 0;  //Base case or if we've hit the final component
  542.     }
  543. //  End of tab control methods....
  544.  
  545.     public void resetControls(TextField[] tfList, Checkbox[] cbList, Button[] bList, String sempId) {
  546.         int imaxLoops = tfList.length, iloopCnt = 0;
  547.         for (iloopCnt = 1; iloopCnt < imaxLoops; iloopCnt++)
  548.             tfList[iloopCnt].setText("");
  549.         iloopCnt = 0;
  550.         imaxLoops = cbList.length;
  551.         for (iloopCnt = 0; iloopCnt < imaxLoops; iloopCnt++)
  552.             cbList[iloopCnt].setState(false);
  553.         imaxLoops = bList.length;
  554.         iloopCnt = 0;
  555.         for(iloopCnt = 0; iloopCnt < imaxLoops; iloopCnt++) {
  556.             if (iloopCnt != 5) //The new_insert button...
  557.                 bList[iloopCnt].disable();
  558.             else
  559.                 bList[iloopCnt].setLabel("Insert");
  560.         }
  561.         tfList[0].setText(sempId);
  562.         tfList[1].requestFocus();
  563.     }
  564.  
  565.     public void selChangeDeptNames(Event ev) {
  566.         String dept = "dept";
  567.         int dept_id = db.idLookup(l_dept_names.getSelectedItem(), dept);
  568.         glList[1].clear();
  569.         db.populateMgrList(dept_id, glList[1]);
  570.     }
  571. }
  572.