{"id":264946,"date":"2015-09-04T13:53:02","date_gmt":"2015-09-04T09:53:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264946"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264946","title":{"rendered":"\u0418\u0433\u0440\u0430 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 Java \u043e\u0442 \u043d\u043e\u0432\u0438\u0447\u043a\u0430, \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432"},"content":{"rendered":"<p>             \u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430 Java, \u0438 \u043f\u0443\u0442\u044c \u043c\u043e\u0439 \u043f\u0440\u043e\u0439\u0434\u0435\u043d \u0442\u044b\u0441\u044f\u0447\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b3a\/e28\/377\/b3ae28377f734b71ac7bd85b6b9ed3fd.jpg\"\/><\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0435\u0442 \u0434\u043e\u043b\u0433\u0438\u0439 \u0438 \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0421\u0430\u043c\u043e\u0439 \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u041a\u043d\u0438\u0433\u0438, \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u0441\u0442\u043e\u0440\u0433 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0417\u0430\u0442\u0435\u043c \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0439 \u043a\u0440\u0443\u0442\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u0438\u0437\u043c\u0430. \u041f\u0430\u0434\u0435\u043d\u0438\u0435 \u0432 \u044f\u043c\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0438\u0447\u0442\u043e\u0436\u0435\u0441\u0442\u0432\u0430, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0418 \u0434\u043e\u043b\u0433\u0438\u0439 \u043f\u0443\u0442\u044c \u043d\u0430\u0432\u0435\u0440\u0445.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0421\u0430\u043c\u043e\u0439 \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u041a\u043d\u0438\u0433\u043e\u0439 \u0441\u0442\u0430\u043b \u0434\u0432\u0443\u0445\u0442\u043e\u043c\u043d\u0438\u043a \u00abJava. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u0430.\u00bb \u0437\u0430 \u0430\u0432\u0442\u043e\u0440\u0441\u0442\u0432\u043e\u043c \u041a\u0435\u044f \u0425\u043e\u0440\u0441\u0442\u043c\u0430\u043d\u043d\u0430 \u0438 \u0413\u0430\u0440\u0438 \u041a\u043e\u0440\u043d\u0435\u043b\u043b\u0430, \u0430 \u0441\u0430\u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u0438\u0433\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043a\u0440\u044b\u043b\u0430 \u0434\u0432\u0435\u0440\u044c \u0432 \u043c\u0438\u0440 Java \u2013 \u042f\u043a\u043e\u0432 \u0424\u0430\u0439\u043d \u00ab\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Java \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439, \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u0434\u0435\u0434\u0443\u0448\u0435\u043a \u0438 \u0431\u0430\u0431\u0443\u0448\u0435\u043a\u00bb.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u044b\u0442\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0440\u0430\u0437\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u043e\u0440\u043d\u043e \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0441\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0437 \u0433\u043e\u043b\u043e\u0432\u044b, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0433\u0440\u0443. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u041e\u0431\u0449\u0430\u044f \u0438\u0434\u0435\u044f (\u043d\u0435 \u043c\u043e\u044f, \u0430 \u0432\u0437\u044f\u0442\u0430 \u0438\u0437 \u0444\u043b\u0435\u0448-\u0438\u0433\u0440\u044b Chain Rxn)<\/h5>\n<p>  \u041d\u0430 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u043c \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0440\u043e\u0432\u043d\u044f, \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0440\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043f\u043e \u043d\u0435\u043c\u0443, \u0441 \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e, \u043e\u0442\u0440\u0430\u0436\u0430\u044f\u0441\u044c \u043e\u0442 \u0441\u0442\u0435\u043d\u043e\u043a. \u0418\u0433\u0440\u043e\u043a \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c \u043c\u044b\u0448\u0438, \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435, \u0438 \u0432 \u0442\u043e\u0447\u043a\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0440\u0430\u0441\u0442\u0443\u0449\u0438\u0439 \u0448\u0430\u0440\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0434\u0438\u0443\u0441\u0430. \u041f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0448\u0430\u0440\u0438\u043a\u0438, \u0435\u0441\u043b\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0438\u043c, \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445, \u0438 \u0442\u0430\u043a\u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442\u0441\u044f \u0438 \u0438\u0441\u0447\u0435\u0437\u0430\u044e\u0442.<\/p>\n<p>  \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u2013 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0440\u0438\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u00ab\u0432\u044b\u0431\u0438\u0442\u043e\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6c1\/6a5\/90c\/6c16a590c06a46d8b934a7311c3398c2.jpg\"\/><\/p>\n<h5>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/h5>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 GameConstants, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u044b \u0432\u0441\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e implements GameConstants:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 GameConstants<\/b><\/p>\n<div class=\"spoiler_text\">public interface GameConstants {<br \/>   public final int DEFAULT_WIDTH = 600;\/\/\u0428\u0438\u0440\u0438\u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f<br \/>   public final int DEFAULT_HEIGHT = 300; \/\/\u0412\u044b\u0441\u043e\u0442\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f<br \/>   public final int DELAY = 8; \/\/\u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0435\u0436\u0434\u0443 \u00ab\u043a\u0430\u0434\u0440\u0430\u043c\u0438\u00bb \u0438\u0433\u0440\u044b<br \/>   public final int BASERADIUS=5; \/\/\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0430\u0440\u0438\u043a\u043e\u0432<br \/>   public final int LIFETIME=1300; \/\/\u0412\u0440\u0435\u043c\u044f \u00ab\u0436\u0438\u0437\u043d\u0438\u00bb \u0448\u0430\u0440\u0438\u043a\u0430<br \/>   public final int MAXRADIUS=25; \/\/\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0430\u0440\u0438\u043a\u0430<br \/>   public final int STARTQNTBALLS=10; \/\/\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0440\u0438\u043a\u043e\u0432 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435<br \/>  }  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u043a\u043b\u0430\u0441\u0441 Ball. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u043e \u043e\u0441\u044f\u043c x \u0438 y, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 dx \u0438 dy, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043f\u043e \u0441\u0443\u0442\u0438 \u2014 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c), \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u0430 \u0438 \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0434\u0438\u0443\u0441\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0446\u0432\u0435\u0442 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0440\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f inAction \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0449\u0430\u044f \u0435\u0433\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e 0 \u2014 \u0434\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f, 1 \u2014 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0438 \u0440\u043e\u0441\u0442, 2 \u2014 \u0436\u0438\u0437\u043d\u044c \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<p>  \u0415\u0449\u0435 \u0432 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0442\u0430\u0439\u043c\u0435\u0440, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u2014 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u00ab\u0436\u0438\u0437\u043d\u0438\u00bb \u0448\u0430\u0440\u0438\u043a\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u0430\u043a \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440. \u041f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 (LIFETIME), \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0438 \u043f\u043e \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 Ball<\/b><\/p>\n<div class=\"spoiler_text\">public class Ball implements GameConstants {<\/p>\n<p>   private int inAction; \/\/ \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0448\u0430\u0440\u0438\u043a\u0430<br \/>   private int x; \/\/ \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u043e x \u0438 y<br \/>   private int y;<br \/>   private int dx; \/\/\u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u043e \u043e\u0441\u044f\u043c x \u0438 y<br \/>   private int dy;<br \/>   private int radius; \/\/\u0440\u0430\u0434\u0438\u0443\u0441<br \/>   private int dRadius; \/\/\u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0440\u0430\u0434\u0438\u0443\u0441\u0430<br \/>   private Color color; \/\/\u0446\u0432\u0435\u0442<br \/>   private static int count;<br \/>   public final int id=count++; \/\/ \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 (\u043d\u043e\u043c\u0435\u0440) \u0448\u0430\u0440\u0438\u043a\u0430<br \/>   private static int score; \/\/ \u0441\u0447\u0451\u0442<br \/>   private Timer gameTimer;<br \/>   private TimerTask gameTimerTask; \/\/\u0442\u0430\u0439\u043c\u0435\u0440 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0448\u0430\u0440\u0438\u043a\u0430<\/p>\n<p>  \/\/\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 Ball<br \/>   Ball(int x, int y, int dx, int dy, int radius, Color color, int inAction, int dRadius){<br \/>   this.x=x;<br \/>   this.y=y;<br \/>   this.dx=dx;<br \/>   this.dy=dy;<br \/>   this.radius=radius;<br \/>   this.color=color;<br \/>   this.inAction=inAction;<br \/>   this.dRadius=dRadius;<br \/>   gameTimer = new Timer();<br \/>   }<\/p>\n<p>  \/\/\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0430\u044f \u0437\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u0448\u0430\u0440\u0438\u043a\u0430<br \/>  public Ellipse2D getShape(){<br \/>   return new Ellipse2D.Double(x-radius, y-radius, radius*2, radius*2);<br \/>   }<\/p>\n<p>  \/\/\u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043c\u044f\u0447\u0438\u043a\u043e\u0432:<br \/>  public void moveBall(BallComponent ballComponent){<br \/>   x+=dx;<br \/>   y+=dy;<br \/>   radius+=dRadius;<\/p>\n<p>   if(x&lt;=0+radius){<br \/>   x=radius;<br \/>   dx=-dx;<br \/>   }<br \/>   if (x&gt;=DEFAULT_WIDTH-radius){<br \/>   x=DEFAULT_WIDTH-radius;<br \/>   dx=-dx;<br \/>   }<\/p>\n<p>   if(y&lt;=0+radius){<br \/>   y=radius;<br \/>   dy=-dy;<br \/>   }<\/p>\n<p>   if (y&gt;=DEFAULT_HEIGHT-radius){<br \/>   y=DEFAULT_HEIGHT-radius;<br \/>   dy=-dy;<br \/>   }<\/p>\n<p>   for(Ball ballVer: ballComponent.listBall){<br \/>   \/*<br \/>   \u0421\u0442\u043e\u043b\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u2014 \u043c\u044b \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u043c \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u043c\u0443 \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Ball, \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043b\u0438 \u00ab\u043d\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439\u00bb \u0448\u0430\u0440\u0438\u043a, \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u043c (ballVer), \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0439 \u0448\u0430\u0440<br \/>  *\/<br \/>   if(inAction==0)<br \/>   if((Math.sqrt(Math.pow(x-ballVer.x,2)+Math.pow(y-ballVer.y,2)))&lt;=radius+ballVer.radius &#038;&#038;<br \/>   id!=ballVer.id &#038;&#038; <br \/>   (ballVer.inAction==1 || ballVer.inAction==2)) {<br \/>   ballComponent.score++;<br \/>   ballComponent.totalScore++;<br \/>   dx=dy=0;<br \/>   inAction=1;<br \/>   ballComponent.setBackground(ballComponent.getBackground().brighter());<br \/>   }<\/p>\n<p>   if(inAction==1){<br \/>   dRadius=1;<br \/>   if (radius&gt;=MAXRADIUS){<br \/>   inAction=2;<br \/>   dRadius=0;<br \/>   \/\/\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u0439\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u043f\u0440\u043e\u0448\u0435\u0441\u0442\u0432\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438, \u043d\u0430\u0447\u043d\u0451\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0430\u0440\u0438\u043a\u0430<br \/>   gameTimerTask = new gameTimerTask(this);<br \/>   gameTimer.schedule(gameTimerTask, LIFETIME); <br \/>   } <br \/>   }<\/p>\n<p>   if(inAction==2 &#038;&#038; radius&lt;=0){<br \/>   ballComponent.listBall.remove(this);<br \/>   }}}<\/p>\n<p>  \/\/\u0442\u0430\u0439\u043c\u0435\u0440, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 LIFETIME, \u0435\u0441\u043b\u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0448\u0430\u0440\u0438\u043a\u0430 \u0434\u043e\u0441\u0442\u0438\u0433 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e:<br \/>  class gameTimerTask extends TimerTask{<\/p>\n<p>  private Ball ballTimer;<\/p>\n<p>   public gameTimerTask(Ball ball) {<br \/>   \/\/ TODO Auto-generated constructor stub<br \/>   this.ballTimer = ball;<br \/>   }<br \/>   public void run() {<br \/>   \/\/ TODO Auto-generated method stub<br \/>   ballTimer.dRadius=-1;<br \/>   }<br \/>   }<br \/>  }  <\/div>\n<\/div>\n<p>  \u041a\u043b\u0430\u0441\u0441 BallComponent \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 JPanel, \u0438 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f.\u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0442\u0438\u043f\u0430 Ball, \u0438 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0441\u0447\u0435\u0442. \u041f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043e\u043d \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 BallComponent<\/b><\/p>\n<div class=\"spoiler_text\">public class BallComponent extends JPanel implements GameConstants {<br \/>   List listBall = new CopyOnWriteArrayList&lt;&gt;();<br \/>   boolean startClick;<br \/>   public int score=0;<br \/>   public int totalScore=0;<\/p>\n<p>  \/\/\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 Ball \u0432 \u0441\u043f\u0438\u0441\u043e\u043a<br \/>   public void addBall(Ball b){<br \/>   listBall.add(b);<br \/>   }<\/p>\n<p>   public void paintComponent(Graphics g){<br \/>   super.paintComponent(g);<br \/>   Graphics2D g2d = (Graphics2D)g;<br \/>   for(Ball ball: listBall){<br \/>   g2d.setColor(ball.getColor());<br \/>   g2d.fill(ball.getShape());<br \/>   }<br \/>   }<\/p>\n<p>  public Dimension getPreferredSize() {<br \/>   return new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT);<br \/>  }}<\/p><\/div>\n<\/div>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0432 \u043b\u0443\u0447\u0448\u0438\u0445 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044f\u0445 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0445 \u0425\u043e\u0440\u0441\u0442\u043c\u0430\u043d\u043d\u0430 \u0438 \u041a\u043e\u0440\u043d\u0435\u043b\u043b\u0430 \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 BallGame, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0441\u044f \u043a\u043b\u0430\u0441\u0441 BallGameFrame():<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 BallGame<\/b><\/p>\n<div class=\"spoiler_text\">public class BallGame implements GameConstants {<br \/>   public static void main(String[] args) {<br \/>   EventQueue.invokeLater(new Runnable() { <br \/>      <a href=\"http:\/\/habrahabr.ru\/users\/override\/\" class=\"user_link\">Override<\/a><br \/>   public void run() {<br \/>   \/\/ TODO Auto-generated method stub<br \/>   JFrame ballFrame = new BallGameFrame();<br \/>   ballFrame.setVisible(true);<br \/>   }});<br \/>   }}  <\/div>\n<\/div>\n<p>  \u041a\u043b\u0430\u0441\u0441 BallGameFrame, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 JFrame, \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 \u0434\u043b\u044f \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043c\u044b\u0448\u0438, \u0432\u044b\u0432\u043e\u0434 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 BallGameFrame<\/b><\/p>\n<div class=\"spoiler_text\">class BallGameFrame extends JFrame implements GameConstants{<br \/>   private int level=1; \/\/\u041f\u0435\u0440\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c<br \/>   private int ballQnt;<br \/>   private BallComponent ballComponent;<br \/>   private MousePlayer mousePlayerListener;<\/p>\n<p>  \/\/\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <br \/>   public BallGameFrame() {<br \/>   ballQnt=STARTQNTBALLS;<br \/>   setTitle(\u00abBallGame\u00bb);<br \/>   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br \/>   ballComponent = new BallComponent();<br \/>   ballComponent.setBackground(Color.DARK_GRAY);<br \/>   mousePlayerListener = new MousePlayer();<br \/>   add(ballComponent, BorderLayout.CENTER);<br \/>   final JPanel buttonPanel = new JPanel(); <br \/>   final JButton startButton = new JButton(\u00ab\u041d\u0430\u0447\u0430\u0442\u044c \u0438\u0433\u0440\u0443.\u00bb);<br \/>   buttonPanel.add(startButton);<br \/>   final JLabel scoreLabel = new JLabel();<br \/>   buttonPanel.add(scoreLabel);<br \/>   startButton.addActionListener(new ActionListener() {<br \/>   public void actionPerformed(ActionEvent arg0) {<br \/>   ballComponent.addMouseListener(mousePlayerListener);<br \/>   ballComponent.addMouseMotionListener(mousePlayerListener);<br \/>   startButton.setVisible(false);<br \/>   ballComponent.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));<br \/>   startGame(scoreLabel, ballQnt); <br \/>   }});<br \/>   add(buttonPanel, BorderLayout.SOUTH);<br \/>   pack(); <br \/>   }<br \/>  public void startGame(JLabel scoreLabel, int ballQnt){ <br \/>   Runnable r = new BallRunnable(ballComponent, scoreLabel, level, ballQnt);<br \/>   Thread t = new Thread\u00ae;<br \/>   t.start();<br \/>   }<br \/>  \/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u041a\u043b\u0430\u0441\u0441 MousePlayer, \u0434\u043b\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043e\u0442 \u043c\u044b\u0448\u0438:<br \/>  class MousePlayer extends MouseAdapter{<br \/>   public void mouseClicked(MouseEvent e) { \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0440\u0438\u043a \u0438\u0433\u0440\u043e\u043a\u0430<br \/>   \/\/ TODO Auto-generated method stub<br \/>   Random random = new Random();<br \/>   Ball ball = new Ball(e.getX(), <br \/>   e.getY(),<br \/>   0,<br \/>   0,<br \/>   BASERADIUS, <br \/>   new Color(random.nextInt(255),random.nextInt(255),random.nextInt(255)),<br \/>   1,<br \/>   1);<br \/>   ballComponent.startClick=true;<br \/>   ballComponent.addBall(ball);<br \/>   \/\/\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044f \u043c\u044b\u0448\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043c\u043e\u0433 \u043d\u0430\u043a\u043b\u0438\u043a\u0430\u0442\u044c \u0435\u0449\u0435 \u0448\u0430\u0440\u0438\u043a\u043e\u0432, \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u0443\u0440\u0441\u043e\u0440 \u043c\u044b\u0448\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435<br \/>   ballComponent.removeMouseListener(mousePlayerListener);<br \/>   ballComponent.removeMouseMotionListener(mousePlayerListener);<br \/>   ballComponent.setCursor(Cursor.getDefaultCursor());<br \/>   }}}  <\/div>\n<\/div>\n<p>  \u041a\u043b\u0430\u0441\u0441 BallRunnable, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 BallRunnable,  \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">class BallRunnable implements Runnable, GameConstants{<br \/>   private BallComponent ballComponent;<br \/>   private JLabel scoreLabel;<br \/>   private int level, ballQnt;<br \/>   private MousePlayer mousePlayerListener;<br \/>   private int goal;<\/p>\n<p>   public BallRunnable(final BallComponent ballComponent, JLabel scoreLabel, int level, int ballQnt) {<\/p>\n<p>   this.ballComponent = ballComponent;<br \/>   this.scoreLabel = scoreLabel;<br \/>   this.level=level;<br \/>   this.ballQnt=ballQnt;<br \/>   this.goal=2;<br \/>   }<\/p>\n<p>   class MousePlayer extends MouseAdapter{<\/p>\n<p>  public void mousePressed(MouseEvent e) {<br \/>   Random random = new Random();<br \/>   Ball ball = new Ball(e.getX(), <br \/>   e.getY(),<br \/>   0,<br \/>   0,<br \/>   BASERADIUS, <br \/>   new Color(random.nextInt(255),random.nextInt(255),random.nextInt(255)),<br \/>   1,<br \/>   1);<br \/>   ballComponent.addBall(ball);<br \/>   ballComponent.startClick=true;<br \/>   ballComponent.removeMouseListener(mousePlayerListener);<br \/>   ballComponent.removeMouseMotionListener(mousePlayerListener);<br \/>   ballComponent.setCursor(Cursor.getDefaultCursor());<br \/>   }}<br \/>   public void run(){<br \/>   while(true){ <br \/>   try{<br \/>   mousePlayerListener = new MousePlayer();<br \/>   ballComponent.addMouseListener(mousePlayerListener);<br \/>   ballComponent.addMouseMotionListener(mousePlayerListener);<\/p>\n<p>   \/\/\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043d\u0430 \u043a\u0440\u0435\u0441\u0442\u0438\u043a<br \/>   ballComponent.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));<\/p>\n<p>   \/\/\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0448\u0430\u0440\u0438\u043a\u043e\u0432 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435<br \/>   int countInWork=1;<\/p>\n<p>   \/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<br \/>   for (int i=0;i&lt;ballQnt; i++){<br \/>   Random randomX = new Random();<br \/>   Random randomY = new Random();<br \/>   Ball ball = new Ball(randomX.nextInt(DEFAULT_WIDTH), <br \/>   randomY.nextInt(DEFAULT_HEIGHT),<br \/>   randomX.nextInt(2)+1,<br \/>   randomY.nextInt(2)+1,<br \/>   BASERADIUS,<br \/>   new Color(randomX.nextInt(255),randomX.nextInt(255),randomX.nextInt(255)),<br \/>   0,<br \/>   0);<br \/>   ballComponent.addBall(ball); <br \/>   }<\/p>\n<p>  \/\/ \u043f\u043e\u043a\u0430 \u0435\u0441\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0448\u0430\u0440\u0438\u043a\u0438<br \/>   while (countInWork!=0){ <br \/>   countInWork=0; <br \/>   if(!ballComponent.startClick) {<br \/>   EventQueue.invokeLater(new Runnable() { <br \/>   public void run() {<br \/>   \/\/ TODO Auto-generated method stub<br \/>   scoreLabel.setText(\u00ab\u0426\u0435\u043b\u044c: \u0432\u044b\u0431\u0438\u0442\u044c \u201e+ goal+\u201c \u0448\u0430\u0440\u043e\u0432 \u0438\u0437 \u201e+ ballQnt); <br \/>   }<br \/>   }<br \/>   );<br \/>   countInWork=1;<br \/>   } <br \/>   for(Ball ball: ballComponent.listBall){<br \/>   if((ball.inAction()==1 || ball.inAction()==2)) countInWork++; \/\/\u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0448\u0430\u0440\u0438\u043a\u0438 <br \/>   ball.moveBall(ballComponent);<br \/>   ballComponent.repaint();<br \/>   if(ballComponent.startClick){<br \/>   \/\/\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443<br \/>   EventQueue.invokeLater(new Runnable() { <br \/>   public void run() {<br \/>   scoreLabel.setText(\u201c\u0423\u0440\u043e\u0432\u0435\u043d\u044c: \u201e+ level+\u201c, \u0412\u044b \u0432\u044b\u0431\u0438\u043b\u0438 \u201e+ballComponent.score+\u201c \u0438\u0437 \u201e+ballQnt); <br \/>   }});<br \/>  }}<br \/>   Thread.sleep(DELAY);<br \/>   }<br \/>   } catch (InterruptedException ex){<br \/>   ex.printStackTrace(); <br \/>   }<br \/>   ballComponent.listBall.clear();<br \/>   ballComponent.repaint();<br \/>   \/\/\u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <br \/>   if(ballComponent.score&lt;goal) {<br \/>   EventQueue.invokeLater(new Runnable() {<br \/>   public void run() {<br \/>   scoreLabel.setText(\u201c\u0426\u0435\u043b\u044c \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u0430!\u00bb); <br \/>   }<br \/>   });<br \/>   JOptionPane.showMessageDialog(ballComponent, <br \/>   \u00ab\u0426\u0435\u043b\u044c \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u0430. \\n\u041d\u0430\u0431\u0440\u0430\u043d\u043e \u043e\u0447\u043a\u043e\u0432: \u201e+<br \/>   ballComponent.totalScore+\u201c.\\n \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437.\u00bb);<br \/>   ballComponent.startClick=false;<br \/>   ballComponent.score=0;<br \/>   ballComponent.setBackground(Color.DARK_GRAY);<br \/>   }<br \/>   else{<br \/>   EventQueue.invokeLater(new Runnable() {<br \/>   public void run() {<br \/>   scoreLabel.setText(\u00ab\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u043f\u0440\u043e\u0439\u0434\u0435\u043d!!!\u00bb);<br \/>   }<br \/>   });<br \/>   ballComponent.startClick=false;<br \/>   level++;<br \/>   ballQnt++;<br \/>   goal++;<br \/>   ballComponent.setBackground(Color.DARK_GRAY);<br \/>   ballComponent.score=0;<br \/>   JOptionPane.showMessageDialog(ballComponent, \u00ab\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u201e+level+\u201c.\\n\u0426\u0435\u043b\u044c: \u0432\u044b\u0431\u0438\u0442\u044c \u201e+ goal+\u201c \u0448\u0430\u0440\u043e\u0432 \u0438\u0437 \u201e+ ballQnt);<br \/>   }}}  <\/div>\n<\/div>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432\u044b\u0432\u043e\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0425\u043e\u0440\u0441\u0442\u043c\u0430\u043d\u043d\u0435, \u0433\u043b\u0430\u0432\u0430 14 \u00ab\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u00bb, \u0440\u0430\u0437\u0434\u0435\u043b \u00ab\u041f\u043e\u0442\u043e\u043a\u0438 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Swing\u00bb.<\/p>\n<p>  \u0421 \u043a\u0430\u0436\u0434\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0440\u0438\u043a\u043e\u0432, \u0438 \u0446\u0435\u043b\u044c (\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0438\u0442\u044c). \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b, \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u043e\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0431\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0448\u0430\u0440\u0438\u043a\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 8 \u0438\u0437 10), \u043d\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u043a\u0443\u0447\u043d\u043e, \u0438 \u0438\u0433\u0440\u0443 \u0437\u0430\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c <s>\u0433\u0440\u0430\u0434\u0443\u0441 \u043d\u0435\u0430\u0434\u0435\u043a\u0432\u0430\u0442\u0430<\/s> \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043a\u043e\u0440\u0434 \u2014 86 \u0443\u0440\u043e\u0432\u0435\u043d\u044c. \u0421\u0430\u043c \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u043e\u0448\u0435\u043b \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0434\u043e 15 \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>  \u0417\u0430\u0441\u0438\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043e\u0442\u043a\u043b\u0430\u043d\u044f\u0442\u044c\u0441\u044f. \u0416\u0434\u0443 \u0441\u043e\u0432\u0435\u0442\u043e\u0432\/\u043a\u0440\u0438\u0442\u0438\u043a\u0438\/\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438\/\u0432\u043e\u0441\u0445\u0432\u0430\u043b\u0435\u043d\u0438\u044f (\u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u043d\u0443\u0442\u044c).             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/266117\/\"> http:\/\/habrahabr.ru\/post\/266117\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430 Java, \u0438 \u043f\u0443\u0442\u044c \u043c\u043e\u0439 \u043f\u0440\u043e\u0439\u0434\u0435\u043d \u0442\u044b\u0441\u044f\u0447\u0430\u043c\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b3a\/e28\/377\/b3ae28377f734b71ac7bd85b6b9ed3fd.jpg\"\/><\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0435\u0442 \u0434\u043e\u043b\u0433\u0438\u0439 \u0438 \u043c\u0443\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u0421\u0430\u043c\u043e\u0439 \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u041a\u043d\u0438\u0433\u0438, \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u0441\u0442\u043e\u0440\u0433 \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0435\u0440\u0435\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0435 \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u0417\u0430\u0442\u0435\u043c \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0440\u0430\u0441\u0442\u0443\u0449\u0435\u0439 \u043a\u0440\u0443\u0442\u043e\u0441\u0442\u0438 \u0438 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u0438\u0437\u043c\u0430. \u041f\u0430\u0434\u0435\u043d\u0438\u0435 \u0432 \u044f\u043c\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0438\u0447\u0442\u043e\u0436\u0435\u0441\u0442\u0432\u0430, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0418 \u0434\u043e\u043b\u0433\u0438\u0439 \u043f\u0443\u0442\u044c \u043d\u0430\u0432\u0435\u0440\u0445.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0421\u0430\u043c\u043e\u0439 \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u041a\u043d\u0438\u0433\u043e\u0439 \u0441\u0442\u0430\u043b \u0434\u0432\u0443\u0445\u0442\u043e\u043c\u043d\u0438\u043a \u00abJava. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u0430.\u00bb \u0437\u0430 \u0430\u0432\u0442\u043e\u0440\u0441\u0442\u0432\u043e\u043c \u041a\u0435\u044f \u0425\u043e\u0440\u0441\u0442\u043c\u0430\u043d\u043d\u0430 \u0438 \u0413\u0430\u0440\u0438 \u041a\u043e\u0440\u043d\u0435\u043b\u043b\u0430, \u0430 \u0441\u0430\u043c\u043e\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u0438\u0433\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043a\u0440\u044b\u043b\u0430 \u0434\u0432\u0435\u0440\u044c \u0432 \u043c\u0438\u0440 Java \u2013 \u042f\u043a\u043e\u0432 \u0424\u0430\u0439\u043d \u00ab\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Java \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439, \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u0435\u0439, \u0434\u0435\u0434\u0443\u0448\u0435\u043a \u0438 \u0431\u0430\u0431\u0443\u0448\u0435\u043a\u00bb.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043f\u044b\u0442\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0440\u0430\u0437\u0431\u0435\u0436\u0430\u0442\u044c\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u043e\u0440\u043d\u043e \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0441\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0437 \u0433\u043e\u043b\u043e\u0432\u044b, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0433\u0440\u0443. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264946","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264946"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264946\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}