Reputation: 15
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;
}
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 JTextField
s with a List<Consulta>
that is fed with data from the database.
Here is a screenshot of an example of how the application works:
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