private void selFolder() {
   // selects a single folder, then makes table uneditable other than launch, sel res folder and
   // cancel, gui table different, just shows folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       dtm.getDataVector().removeAllElements();
       dtm.fireTableDataChanged();
       curRow = 0;
       addRow();
       dtm.setValueAt(
           "You have chosen the folder '" + dirImp.substring(67) + "' and all of its subfolders.",
           0,
           0);
       dtm.setValueAt(dirImp.substring(67), 0, 1);
       if (table.getRowCount() > 0) {
         openF.setEnabled(false);
         openFo.setEnabled(false);
         selFo.setEnabled(false);
         canF.setEnabled(true);
       }
       selFoFl = 1;
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
  public static void refreshCalendar(int month, int year) {
    // instantiation
    String[] months = {
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
    };
    int numoday, startom; // Number Of Days, Start Of Month

    // Allow/disallow buttons
    prev.setEnabled(true);
    next.setEnabled(true);
    if (month == 0 && year <= ryear) {
      prev.setEnabled(false);
    } // Cannot set an appointment back in time
    if (month == 11 && year >= ryear + 50) {
      next.setEnabled(false);
    } // Too early to set an appointment
    lmonth.setText(months[month]); // Refresh the month label (at the top)
    lmonth.setBounds(
        160 - lmonth.getPreferredSize().width / 2, 25, 180, 25); // Re-align label with calendar
    cyear.setSelectedItem(String.valueOf(year)); // Select the correct year in the combo box

    // deletes current table
    for (int i = 0; i < 6; i++) {
      for (int j = 0; j < 7; j++) {
        mcal.setValueAt(null, i, j);
      }
    }

    // Get first day of month and number of days
    GregorianCalendar cal = new GregorianCalendar(year, month, 1);
    numoday = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
    startom = cal.get(GregorianCalendar.DAY_OF_WEEK);

    // Create calendar
    for (int i = 1; i <= numoday; i++) {
      int row = new Integer((i + startom - 2) / 7);
      int column = (i + startom - 2) % 7;
      mcal.setValueAt(i, row, column);
    }

    // Apply renderers
    Cal.setDefaultRenderer(Cal.getColumnClass(0), new tblCalendarRenderer());
  }
 private void openFile() {
   // opens a single file chooser (can select multiple), does not traverse folders.
   this.copyList = new ArrayList();
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setMultiSelectionEnabled(true);
   fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
   FileNameExtensionFilter filterhtml = new FileNameExtensionFilter("HTML File (.html)", "html");
   fc.addChoosableFileFilter(filterhtml);
   fc.setFileFilter(filterhtml);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getCurrentDirectory();
   dirImp = dir.toString();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       for (File file1 : fc.getSelectedFiles()) {
         fileImp = file1.toString();
         boolean exists = false;
         for (int i = 0; i < table.getRowCount(); i++) {
           dir = fc.getCurrentDirectory();
           dirImp = dir.toString();
           String copyC = dtm.getValueAt(i, 0).toString();
           if (duplC.isSelected()) {
             if (fileImp.endsWith(copyC)) {
               exists = true;
               break;
             }
           }
         }
         if (!exists) {
           addRow();
           dtm.setValueAt(fileImp.substring(67), curRow, 0);
           dtm.setValueAt(dirImp.substring(67), curRow, 1);
           curRow++;
           if (headC == 1) {
             if (fileImp.substring(67).endsWith(dirImp.substring(67) + ".html")) {
               curRow--;
               dtm.removeRow(curRow);
             }
           }
         }
       }
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
 private void openFolder() {
   // opens all htmls in a folder other than the one with same name as folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   file = fc.getSelectedFiles();
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       File[] filesInDirectory = dir.listFiles();
       for (File file1 : filesInDirectory) {
         String fileS = file1.toString();
         fileS.substring(fileS.lastIndexOf('.') + 1);
         if (fileS.contains("html")) {
           fileImp = file1.toString();
           boolean exists = false;
           for (int i = 0; i < table.getRowCount(); i++) {
             String copyC = dtm.getValueAt(i, 0).toString();
             if (duplC.isSelected()) {
               if (fileImp.contains(copyC)) {
                 exists = true;
                 break;
               }
             }
           }
           if (!exists) {
             addRow();
             dtm.setValueAt(fileImp.substring(67), curRow, 0);
             dtm.setValueAt(dirImp.substring(67), curRow, 1);
             curRow++;
             if (headC == 1) {
               if (fileImp.substring(67).endsWith(dirImp.substring(67) + ".html")) {
                 curRow--;
                 dtm.removeRow(curRow);
               }
             }
           }
         }
       }
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
 public void setValueAt(Object obj, int row, int col) {
   if (obj instanceof Education)
     super.setValueAt(new Education((Education) obj, EmployeeAttribute.CODE), row, col);
   else if (obj instanceof JobTitle)
     super.setValueAt(new JobTitle((JobTitle) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Organization)
     super.setValueAt(
         new Organization((Organization) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Unit)
     super.setValueAt(new Unit((Unit) obj, Unit.CODE_DESCRIPTION), row, col);
   else if (obj instanceof WorkAgreement)
     super.setValueAt(
         new WorkAgreement((WorkAgreement) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof SexType)
     super.setValueAt(new SexType((SexType) obj, EmployeeAttribute.DESCRIPTION), row, col);
   else if (obj instanceof Qualification)
     super.setValueAt(new Qualification((Qualification) obj, EmployeeAttribute.CODE), row, col);
   else super.setValueAt(obj, row, col);
 }