We can override the paintComponent(Graphics g) method of JComponent.
It is called automatically to refresh the screen.
What can I do that is called regularly, for example every 100 ms.
Is this possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Maybe your purpose is refreshing the component every certain ms?
If so, there’s a few options available.
The use of
Timeris a first option. Example here.The option most people use is
Threadanimation. Here is an example.Also there’s a timing framework available to download. I can’t find an available link, but just search for it on the internet.
Hope this helps.