title: Loading from a database to a jlist brings errors
body: <p>I have created a database and every entry from the JList will be added to a table in the database. This work perfectly, but my next task is to get whatever is in the database to load to the JList. I have a function created within the button but it brings up errors. I'm struggling with how to fix this so I hope somebody can resolve it.</p>
  
  <p>Thanks</p>
  
  <p>Here is my code:</p>
  
  <pre><code>JButton btnDb1 = new JButton("J");          
  btnDb1.addActionListener(new ActionListener() {                
  
      public void actionPerformed(ActionEvent arg0) {            
          try {       
              ResultSet rs = st.executeQuery("SELECT * FROM patient");
              while (rs.next()) {
                  Patient patient = new Patient(patientname, patientaddress, patientphone, patientid);
                  patient.setName(rs.getString("patientname"));
                  patient.setAddress(rs.getString("patientaddress"));
                  patient.setPhoneNum(rs.getString("patientphone"));
                  patient.setID(rs.getInt("patientid"));
                  MainDentist.model.addElement(patient);    
              }
          } catch (Exception e) {
              System.out.println(" Error ");                      
          }
      }
  });
  
  btnDb1.setBounds(200, 393, 120, 23);
  contentPane.add(btnDb1);
  </code></pre>
  
  <p>Here is my patient class:</p>
  
  <pre><code>public class Patient { 
      public String patientName;
      public String patientAddress;
      public String patientPhone;
      public int patientID;
  
      public Patient(String patientname, String patientaddress, String patientphone,int patientid){
          patientName = patientname;
          patientAddress = patientaddress;
          patientPhone = patientphone;
          patientID = patientid;
      }
  
      public String setName(String patientname){            
          return patientName = patientname;
      }
  
      public String getName(){            
          return patientName;            
      }
  
      public String setAddress(String patientaddress){            
          return patientAddress = patientaddress;      
      }
  
      public String getAddress(){            
          return patientAddress;
      }
  
      public String setPhoneNum(String patientphone){
          return patientPhone = patientphone;
      }
  
      public String getPhoneNum(){            
          return patientPhone;
      }
  
      public int setID(int patientid){            
          return patientID = patientid;
      }
  
      public int getID(){            
          return patientID;            
      }
  
      public String toString() { // Printing the patient's details to the scroll pane
          return "Patient Name: " + patientName + ", PatientAddress: "
                  + patientAddress + ", PatientPhone: " + patientPhone
                  + ", patientID: " + patientID +"" ;
      }       
  }
  </code></pre>