Johnny Wesley
Johnny Wesley

Reputation: 15

I want to insert texts into multiple textfields with a list

I'm trying to make a schedule. To bring the list of data from the server, I use this:

public List getListaCon(Date datacon, Date horacon, Date horacon1){
   em.getTransaction().begin();
   Query query = em.createQuery("SELECT c from Consulta c where c.datasconsulta = :datacon and c.hora BETWEEN :horacon and :horacon1");
   query.setParameter("datacon", datacon);
   query.setParameter("horacon", horacon);
   query.setParameter("horacon1", horacon1);
   List<Consulta> lista = query.getResultList();
   em.getTransaction().commit();
   return lista;
 
}

essa é a minha tabela do banco de dados

I basically set a date and time through a JCalendar to create a new tuple on that table in the database. So far so good; the problem is to populate my textfields with the data coming from the server. This would be much easier with a JTable but it doesn't look good visually. I was wondering how I would do to fill these different JTextFields with a List<Consulta> that is fed with data from the database. Here is a screenshot of an example of how the application works:

schedule exemple

Each line of JTextField that is separated by JSeparator would represent a scheduled time. For example, 07:00 would bring the name that was scheduled according to the time that was scheduled when saved, the second column would just be to add another field of that class.

Please if there is still any doubt about something, put it in the answers, so I can improve and facilitate understanding.

Upvotes: 0

Views: 37

Answers (0)

Related Questions