public void valueChanged(ListSelectionEvent e) {
        if (!e.getValueIsAdjusting()) {
            if ((this.PFPanel.getSelectedIndex() == 0 || this.PFPanel.getSelectedIndex() == 1) &&
                    patientList.getSelectedIndex() >= 0 &&
                    e.getSource() == patientList) {
                String st = patientList.getSelectedValue().toString();
                function.patientInfo(patient, st, patient2TF, patientTP, null);

                ptid = function.patientInfo(patient, st, patient2TF, patientTP, null);
            }
            else if ((this.PFPanel.getSelectedIndex() == 0 || this.PFPanel.getSelectedIndex() == 1) &&
                    drugList.getSelectedIndex() >= 0 &&
                    e.getSource() == drugList) {
                String st = drugList.getSelectedValue().toString();

                function.drugInfo(drugs, st, patient2TF[2],  null);

                this.drugId = function.drugInfo(drugs, st, patient2TF[2],  patientTA[2]);

                drugstr += String.valueOf(drugId).concat("|");

               patient2TF[2].setText("");
            }
        }
    }