Refresh in jframe automatically

0

I will start a project where I will control queues in java, even normal queues, as if you arrived at the bank and saw the name on the screen.

I'll give you a summary of the project to be clearer.

I have 10 computers, each one belongs to one person, these people request something simultaneously. In another jframe will display who requested first, will display the name of the person and the time that requested it, once it is answered the name is removed from the queue, for example:

Solicitante | Tempo que fez a solicitação
João        | 2:45
Roberto     | 1:58
Olivia      | 0:50
Pedro       | 0:15

However, I need to display this in real time, that is, it will present the requested time in real time and also as soon as someone gets in the queue or exit it will also happen in real time

I need a way to refresh the jframe that will perform this display automatically, either every 2 seconds, or 3 ... anyway

I have a need to do this in JAVA

Does anyone know of any method that I can program this refresh or some way to do it automatically?

    
asked by anonymous 27.06.2016 / 16:32

1 answer

0

This will depend on the component you use to display the information. Always when there is a new request only update the component you are using, when you remove the request then refresh again, you should never give a refresh in the entire jframe, only in the component that the information should be updated. Start doing your project, each graphic component has a way to update the information, when it can not ask a new question informing you what you are using.

Example: a JList vc uses the fireContentsChanged(...) method, already in a JTable you use the fireTableDataChanged() method.

You do not need a timer that updates in a given time interval. If you know the moment the event occurs then just implement the components update.

    
28.06.2016 / 03:37