Advertisement
sergAccount

Untitled

Dec 20th, 2020
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package app13;
  7.  
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10. import javax.swing.JPanel;
  11. import javax.swing.Timer;
  12.  
  13. public class DrawPanel extends JPanel implements ActionListener {
  14.     // переменная типа таймер - для выполнения период-ких действий
  15.     Timer drawTimer;
  16.     //
  17.     public DrawPanel(){
  18.         // создаем объект типа Timer
  19.         drawTimer = new Timer(2000, this);
  20.         // запуск таймера - используем метод start
  21.         drawTimer.start();        
  22.     }
  23.     @Override
  24.     public void actionPerformed(ActionEvent e) {
  25.         // данный метод будет вызваться периодически (через опред интерфал времени)
  26.         System.out.println("actionPerformed!!!");
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement