Question: Ex 13.19 (Screen Saver Using Timer) Package javax.swing contains a class called Timer thatis capable of calling method actionPerformed of interface ActionListener at a fixed
Ex 13.19 (Screen Saver Using Timer) Package javax.swing contains a class called Timer thatis capable of calling method actionPerformed of interface ActionListener at a fixed time interval (specified in milliseconds). Modify your solution to Exercise 13.18 to remove the call to repaint from method paintComponent. Declare your class to implement ActionListener. (The actionPerformed method should simply call repaint.) Declare an instance variable of type Timer called timer in your class. In the constructor for your class, write the following statements:timer = new Timer(1000, this);timer.start();This creates an instance of class Timer that will call this objects actionPerformed method every 1000 milliseconds (i.e., every second).
This is a JAVA program. The link below contains the template you may need.
https://drive.google.com/open?id=1lI4RA9-86wm-dgSl-sDwPIXQc4b4Dps9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
