{"id":319914,"date":"2021-03-19T15:01:02","date_gmt":"2021-03-19T15:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=319914"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=319914","title":{"rendered":"\u0420\u0430\u0434\u0438\u043e \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Java"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c! \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0432 \u0441\u0432\u043e\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/company\/itsoft\/blog\/547020\/\">\u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a>, \u044f \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c. \u041f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0435\u043b\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u044f \u0441 Java. \u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 Java \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 JavaFX. \u0422\u043e\u0447\u043d\u0435\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0441\u0432\u044f\u0437\u043a\u0430 JavaFX + FXML, \u0433\u0434\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443, \u0430 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c fxml-\u0444\u0430\u0439\u043b\u0435. \u0420\u0430\u0434\u0438\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 JLayer. \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 MediaPlayer \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0443 \u043c\u0435\u043d\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0417\u0430\u043f\u0438\u0441\u044c \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445. \u0420\u0430\u0434\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/kalexal-kaa\/RadioEng\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0435\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 NetBeans 8.2 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 Scene Builder \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Gluon. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u043b\u0438\u0448\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445.<\/p>\n<h2>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434<\/h2>\n<p> \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/184\/d0f\/180\/184d0f1804ff572c17079bd2aa7a254f.png\" width=\"535\" height=\"337\"><figcaption><\/figcaption><\/figure>\n<p> \u0412 \u043c\u0435\u043d\u044e \u00abStation\u00bb \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0443\u043d\u043a\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u0412 \u043c\u0435\u043d\u044e \u00abRecord\u00bb \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u043c\u0435\u043d\u044e \u00abReference\u00bb \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u0443\u043d\u043a\u0442 \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u0443\u043d\u043a\u0442 \u00ab\u041e \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\u00bb, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.  <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u044f \u0434\u0443\u043c\u0430\u044e, \u0438\u0437\u043b\u0438\u0448\u043d\u0438.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;  &lt;?import javafx.scene.control.Button?&gt; &lt;?import javafx.scene.control.Label?&gt; &lt;?import javafx.scene.control.ListView?&gt; &lt;?import javafx.scene.control.Menu?&gt; &lt;?import javafx.scene.control.MenuBar?&gt; &lt;?import javafx.scene.control.MenuItem?&gt; &lt;?import javafx.scene.layout.AnchorPane?&gt; &lt;?import javafx.scene.text.Font?&gt;  &lt;AnchorPane maxHeight=\"-Infinity\" maxWidth=\"-Infinity\" minHeight=\"-Infinity\" minWidth=\"-Infinity\" prefHeight=\"300.0\" prefWidth=\"535.0\" xmlns=\"http:\/\/javafx.com\/javafx\/8.0.171\" xmlns:fx=\"http:\/\/javafx.com\/fxml\/1\" fx:controller=\"radioplayer.PlayerController\"&gt;    &lt;ListView fx:id=\"stationsListView\" focusTraversable=\"false\" layoutX=\"14.0\" layoutY=\"36.0\" prefHeight=\"246.0\" prefWidth=\"200.0\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.leftAnchor=\"14.0\" AnchorPane.topAnchor=\"36.0\" \/&gt;    &lt;Button fx:id=\"playButton\" focusTraversable=\"false\" layoutX=\"240.0\" layoutY=\"177.0\" mnemonicParsing=\"false\" onAction=\"#playAction\" prefHeight=\"103.0\" prefWidth=\"130.0\" text=\"PLAY\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.rightAnchor=\"165.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold\" size=\"22.0\" \/&gt;       &lt;\/font&gt;&lt;\/Button&gt;    &lt;Button fx:id=\"stopButton\" focusTraversable=\"false\" layoutX=\"391.0\" layoutY=\"177.0\" mnemonicParsing=\"false\" onAction=\"#stopAction\" prefHeight=\"103.0\" prefWidth=\"130.0\" text=\"STOP\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.rightAnchor=\"14.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold\" size=\"22.0\" \/&gt;       &lt;\/font&gt;&lt;\/Button&gt;    &lt;Label fx:id=\"nameStation\" layoutX=\"240.0\" layoutY=\"46.0\" prefHeight=\"113.0\" prefWidth=\"279.0\" wrapText=\"true\" AnchorPane.bottomAnchor=\"141.0\" AnchorPane.rightAnchor=\"14.0\" AnchorPane.topAnchor=\"36.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold Italic\" size=\"24.0\" \/&gt;       &lt;\/font&gt;&lt;\/Label&gt;    &lt;MenuBar prefHeight=\"29.0\" prefWidth=\"535.0\" AnchorPane.leftAnchor=\"0.0\" AnchorPane.rightAnchor=\"0.0\" AnchorPane.topAnchor=\"0.0\"&gt;      &lt;menus&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Station\"&gt;          &lt;items&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#addAction\" text=\"Add\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#editAction\" text=\"Edit\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#deleteAction\" text=\"Delete\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Record\"&gt;          &lt;items&gt;            &lt;MenuItem fx:id=\"recordItem\" mnemonicParsing=\"false\" onAction=\"#recordAction\" text=\"To begin\" \/&gt;            &lt;MenuItem fx:id=\"stopRecordItem\" mnemonicParsing=\"false\" onAction=\"#stopRecordAction\" text=\"Stop\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#directoryRecordAction\" text=\"Records Directory\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Reference\"&gt;          &lt;items&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#appInfoAction\" text=\"About the program\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#exitAction\" text=\"Exit\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;      &lt;\/menus&gt;    &lt;\/MenuBar&gt; &lt;\/AnchorPane&gt;<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u0441\u0442\u0438\u043b\u0435\u0439 (toast \u044d\u0442\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041e \u043d\u0438\u0445 \u043f\u043e\u0437\u0436\u0435):  <\/p>\n<pre><code class=\"css\">.root{     -fx-background-color: grey; } .button{     -fx-background-radius: 40;     -fx-border-radius: 40;     -fx-text-fill: white; } .button:hover{     -fx-background-color: derive(-fx-base, 18%);     -fx-border-style: solid;     -fx-border-width: 1;     -fx-border-color: derive(-fx-base, -15%);     -fx-cursor: hand; } .button:pressed{     -fx-text-fill: black; } .list-view, .list-view .viewport, .list-view .content{     -fx-background-color: gainsboro; } .list-view:hover{     -fx-cursor: hand; } .toast{     -fx-background-radius: 30;     -fx-border-radius: 30;     -fx-background-color: black;     -fx-padding: 20; } #nameStation{     -fx-text-fill: white; } #playButton{     -fx-background-color: blue; } #stopButton{     -fx-background-color: red; }<\/code><\/pre>\n<h2>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c<\/h2>\n<p> \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"java\">taskPlayer = new Task() {             @Override             public Void call() {                 try {                     radioUrl = new URL(urlString);                     InputStream in = radioUrl.openStream();                     InputStream is = new BufferedInputStream(in);                     player = new Player(is);                     player.play();                 } catch (FileNotFoundException e) {                     e.getMessage();                 } catch (IOException | JavaLayerException e) {                     e.getMessage();                 }                 return null;             }         };         new Thread(taskPlayer).start();<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c, \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 JLayer. \u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"java\">taskRecord=new Task() {             @Override             public Void call() throws FileNotFoundException, IOException{                     output = new FileOutputStream(reader(file.getAbsolutePath())+                             separator+nameStation.getText()+\"-\"+new Date().toString().replace(\":\",\"-\")+\".mp3\");                     InputStream in = radioUrl.openStream();                     InputStream is = new BufferedInputStream(in);                     byte data[] = new byte[1024];                     int count;                     while ((count = is.read(data)) != -1) {                         output.write(data, 0, count);                     }                 output.flush();                 return null;             }         };         new Thread(taskRecord).start();<\/code><\/pre>\n<h2>\u0421\u0442\u0430\u043d\u0446\u0438\u0438<\/h2>\n<p> \u0421\u0442\u0430\u043d\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0433\u0434\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0446\u0438\u0438, \u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e \u0435\u0435 URL. \u0412\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435:  <\/p>\n<pre><code class=\"java\">private void createDefaultStations(){          String[] stationNames = {\"NonStopPlay\",\"Classical Music\",\"Fip Radio\",\"Jazz Legends\",\"Joy Radio\",\"Live-icy\",\"Music Radio\",\"Radio Electron\",\"Dubstep\",\"Trancemission\"};          String[] stationUrls = {\"http:\/\/stream.nonstopplay.co.uk\/nsp-128k-mp3\",\"http:\/\/stream.srg-ssr.ch\/m\/rsc_de\/mp3_128\",\"http:\/\/direct.fipradio.fr\/live\/fip-midfi.mp3\",\"http:\/\/jazz128legends.streamr.ru\/\",\"http:\/\/airtime.joyradio.cc:8000\/airtime_192.mp3\",\"http:\/\/live-icy.gss.dr.dk:8000\/A\/A05H.mp3\",\"http:\/\/ice-the.musicradio.com\/CapitalXTRANationalMP3\",\"http:\/\/radio-electron.ru:8000\/128\",\"http:\/\/air.radiorecord.ru:8102\/dub_320\",\"http:\/\/air.radiorecord.ru:8102\/tm_320\"};          for(int i=0;i&lt;10;i++){              writer(path+separator+stationNames[i], stationUrls[i]);          }     }<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 dirCreator, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e RadioStations, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0441\u0442\u0430\u043d\u0446\u0438\u0439. \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434:  <\/p>\n<pre><code class=\"java\">private void dirCreator(final String fPath) {         final File file = new File(fPath);         if (!file.exists()) {             file.mkdir();             if(file.exists()){                 alertWindow(\"The &lt;RadioStations&gt; directory has been created.\\nYour radio stations will be here:\\n\"+fPath);                 createDefaultStations();             }else{                 alertWindow(\"Error!\\nThe &lt;RadioStations&gt; directory will not be created.\\n\" +                         \"Try creating the specified directory manually in the following path:\\n\"+fPath+\"\\nThe program will be closed.\");                 System.exit(0);             }         }     }<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c<\/h2>\n<p> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c. \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e:  <\/p>\n<pre><code class=\"java\">private boolean permissionRead(File file){         if(!file.canRead()){             file.setReadable(true);             return !file.canRead();         }         return false;     }     private boolean permissionWrite(File file){         if(!file.canWrite()){             file.setWritable(true);             return !file.canWrite();         }         return false;     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0430\u043f\u043a\u0438 RadioStations:  <\/p>\n<pre><code class=\"java\">@Override     public void initialize(URL url, ResourceBundle rb) {         parentPath = System.getProperty(\"user.home\");         path=parentPath+separator+\"RadioStations\";         this.dirCreator(this.path);         File f=new File(path);         if(permissionRead(f)||permissionWrite(f)){             if(permissionRead(f)&amp;&amp;permissionWrite(f)){                 alertWindow(\"Failed to get permission to read and write files to the &lt;RadioStations&gt; directory.\\nTry to give permission manually.\");             }else if(permissionRead(f)){                 alertWindow(\"Failed to get permission to read files in directory &lt;RadioStations&gt;.\\nTry to give permission manually.\");             }else{                 alertWindow(\"Failed to get permission to write files to &lt;RadioStations&gt; directory.\\nTry to give permission manually.\");             }             System.exit(0);         }         showStationsList();         stopButton.setDisable(true);         recordItem.setDisable(true);         stopRecordItem.setDisable(true);     }   <\/code><\/pre>\n<h2>\u0414\u0438\u0430\u043b\u043e\u0433\u0438<\/h2>\n<p> \u0414\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432 \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0430 \u043f\u0438\u0441\u0430\u043b \u0432\u0441\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0434\u0438\u0430\u043b\u043e\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043a\u0443\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c:  <\/p>\n<pre><code class=\"java\">final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);         alert.setResizable(true);         alert.getDialogPane().setPrefSize(500,200);         alert.setTitle(\"Saving Recordings\");         alert.setHeaderText(\"\");         alert.setContentText(\"The default path for your recordings is:\\n\"+f.getAbsolutePath()+\"\\nChange?\");                  ButtonType buttonTypeEdit = new ButtonType(\"Edit\", ButtonBar.ButtonData.OK_DONE);         ButtonType buttonTypeDefault = new ButtonType(\"Default\", ButtonBar.ButtonData.FINISH);         ButtonType buttonTypeCancel = new ButtonType(\"Cancel\", ButtonBar.ButtonData.CANCEL_CLOSE);                  alert.getButtonTypes().setAll(buttonTypeEdit, buttonTypeDefault, buttonTypeCancel);                  final Optional&lt;ButtonType&gt; resultAlert = alert.showAndWait();<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043e\u043a\u043d\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430:  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7ae\/911\/621\/7ae9116213418aac0ae7a808d4d9e919.png\" width=\"500\" height=\"237\"><figcaption><\/figcaption><\/figure>\n<p> \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u041f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u043e\u043d\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u0438 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u00abEdit\u00bb, \u0442\u043e \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043e\u043a\u043d\u043e \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u0430\u043f\u043a\u0438, \u0430 \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u00abDefault\u00bb, \u0442\u043e \u0434\u0438\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u00abCancel\u00bb \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c.  <\/p>\n<p>\u0412\u043e\u0442 \u0435\u0449\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0438\u0430\u043b\u043e\u0433\u0430. \u042d\u0442\u043e \u0434\u0438\u0430\u043b\u043e\u0433 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u0438:<\/p>\n<pre><code class=\"java\">Dialog dialog = new Dialog&lt;&gt;();         dialog.setTitle(\"Station Creation\");         dialog.setHeaderText(\"Enter the name and url of the radio station\");          ButtonType createButtonType = new ButtonType(\"Create\", ButtonBar.ButtonData.OK_DONE);         ButtonType cancelButtonType  = new ButtonType(\"Cancel\", ButtonBar.ButtonData.CANCEL_CLOSE);         dialog.getDialogPane().getButtonTypes().addAll(createButtonType,cancelButtonType);          GridPane grid = new GridPane();         grid.setHgap(10);         grid.setVgap(10);         grid.setPadding(new Insets(20, 150, 10, 10));          TextField stationName = new TextField();         TextField url = new TextField();          grid.add(new Label(\"Title:\"), 0, 0);         grid.add(stationName, 1, 0);         grid.add(new Label(\"Url:\"), 0, 1);         grid.add(url, 1, 1);          dialog.getDialogPane().setContent(grid);          Optional&lt;ButtonType&gt; result = dialog.showAndWait();<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u043a\u043d\u043e \u0441 \u0434\u0432\u0443\u043c\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438. \u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0435:  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fa\/eff\/10f\/3faeff10fed0d36c2da04cc432524bab.png\" width=\"374\" height=\"218\"><figcaption><\/figcaption><\/figure>\n<p> \u041e\u043a\u043d\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0439 \u0441\u0442\u0430\u043d\u0446\u0438\u0438.  <\/p>\n<h2>\u0417\u0430\u0441\u0442\u0430\u0432\u043a\u0430<\/h2>\n<p> \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u043a\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u0412 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439.  <\/p>\n<pre><code class=\"java\">package radioplayer;  import javafx.application.Application; import java.awt.*; import javafx.stage.Stage; \/**  *  * @author alex  *\/ public class Splash extends Application{          public static void main(final String[] args) {         SplashScreen splash = SplashScreen.getSplashScreen();         try {             Thread.sleep(3000L);         }         catch (InterruptedException ex) {             ex.getMessage();         }         if (splash != null) {             splash.close();             Application.launch(RadioPlayer.class, args);         }     }      @Override     public void start(Stage primaryStage) throws Exception {         throw new UnsupportedOperationException(\"Not supported yet.\"); \/\/To change body of generated methods, choose Tools | Templates.     } }<\/code><\/pre>\n<p>\u0421\u0430\u043c\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u043a\u0430:  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/283\/12d\/199\/28312d199d5ab1a9d1fb761745ed5596.png\" width=\"500\" height=\"300\"><figcaption><\/figcaption><\/figure>\n<p> \u0422\u0430\u043c \u0436\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b:  <\/p>\n<p>-splash:src\/images\/splash.png<\/p>\n<p>\u0412 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c:<\/p>\n<pre><code class=\"xml\">SplashScreen-Image: images\/splash.png<\/code><\/pre>\n<h2>\u0412\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432 Android<\/h2>\n<p> \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 Android OS. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/203\/1dc\/6a8\/2031dc6a8cea6b273da5f2d7590f7c72.png\" width=\"208\" height=\"64\"><figcaption><\/figcaption><\/figure>\n<p> \u0417\u0430 \u0438\u0445 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:  <\/p>\n<pre><code class=\"java\">package radioplayer;  import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.stage.StageStyle; import javafx.util.Duration; \/**  *  * @author alex  *\/ public class Toast {     void setMessage(final String toastMsg){         Stage toastStage=new Stage();         toastStage.setResizable(false);         toastStage.initStyle(StageStyle.TRANSPARENT);         Text t = new Text(toastMsg);         t.setFont(Font.font(\"Verdana\",20));         t.setFill(Color.WHITE);         StackPane root = new StackPane(t);         root.getStyleClass().add(\"toast\");         root.setOpacity(0);         Scene scene = new Scene(root);         scene.getStylesheets().add((getClass().getResource(\"style.css\")).toExternalForm());         scene.setFill(null);         toastStage.setScene(scene);         toastStage.show();         Timeline tl1 = new Timeline();         KeyFrame fadeInKey1 = new KeyFrame(Duration.millis(500),new KeyValue (toastStage.getScene().getRoot().opacityProperty(), 1));         tl1.getKeyFrames().add(fadeInKey1);         tl1.setOnFinished((ae) -&gt;                 new Thread(() -&gt; {                     try {                         Thread.sleep(3000);                     } catch (InterruptedException e) {                         e.getMessage();                     }                     Timeline tl2 = new Timeline();                     KeyFrame fadeOutKey1 = new KeyFrame(Duration.millis(500), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 0));                     tl2.getKeyFrames().add(fadeOutKey1);                     tl2.setOnFinished((aeb) -&gt; toastStage.close());                     tl2.play();                 }).start());         tl1.play();     } }<\/code><\/pre>\n<h2>\u0421\u0431\u043e\u0440\u043a\u0430<\/h2>\n<p> \u0415\u0441\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0430\u0440\u0445\u0438\u0432, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0436\u0430\u0432 \u0432 NetBeans \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0438 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0430\u0440\u0445\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 JLayer. \u0412 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d \u043f\u0443\u0442\u044c \u0434\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0443\u0442\u0438.&nbsp;  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 JLayer \u0437\u0430\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0430\u0440\u0445\u0438\u0432, \u043d\u0443\u0436\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 build.xml \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"xml\">&lt;target name=\"package-for-store\" depends=\"jar\"&gt;     &lt;property name=\"store.jar.name\" value=\"Radio\"\/&gt;     &lt;property name=\"store.dir\" value=\"store\"\/&gt;     &lt;property name=\"store.jar\" value=\"${store.dir}\/${store.jar.name}.jar\"\/&gt;     &lt;echo message=\"Packaging ${application.title} into a single JAR at ${store.jar}\"\/&gt;     &lt;delete dir=\"${store.dir}\"\/&gt;     &lt;mkdir dir=\"${store.dir}\"\/&gt;     &lt;jar destfile=\"${store.dir}\/temp_final.jar\" filesetmanifest=\"skip\"&gt;         &lt;zipgroupfileset dir=\"dist\" includes=\"*.jar\"\/&gt;         &lt;zipgroupfileset dir=\"dist\/lib\" includes=\"*.jar\"\/&gt;         &lt;manifest&gt;             &lt;attribute name=\"Main-Class\" value=\"radioplayer.Splash\"\/&gt;             &lt;attribute name=\"SplashScreen-Image\" value=\"images\/splash.png\"\/&gt;         &lt;\/manifest&gt;     &lt;\/jar&gt;     &lt;zip destfile=\"${store.jar}\"&gt;         &lt;zipfileset src=\"${store.dir}\/temp_final.jar\"         excludes=\"META-INF\/*.SF, META-INF\/*.DSA, META-INF\/*.RSA\"\/&gt;     &lt;\/zip&gt;     &lt;delete file=\"${store.dir}\/temp_final.jar\"\/&gt; &lt;\/target&gt;<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0432 \u043c\u0435\u043d\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u00ab\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0446\u0435\u043b\u044c\u00bb, \u0430 \u0432 \u043f\u043e\u0434\u043c\u0435\u043d\u044e \u043d\u0430\u0439\u0442\u0438 \u00abpackage-for-store\u00bb. \u0412 \u043f\u0430\u043f\u043a\u0435 \u00abstore\u00bb \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0430\u0440\u0445\u0438\u0432.  <\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f <a href=\"https:\/\/sourceforge.net\/projects\/radiowithrecorderenglish\/\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 SourceForge<\/a>. \u0414\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0445!<\/p>\n<\/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=\"https:\/\/habr.com\/ru\/company\/itsoft\/blog\/547908\/\"> https:\/\/habr.com\/ru\/company\/itsoft\/blog\/547908\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442 \u0432\u0441\u0435\u043c! \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0432 \u0441\u0432\u043e\u0435\u043c <a href=\"https:\/\/habr.com\/ru\/company\/itsoft\/blog\/547020\/\">\u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a>, \u044f \u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c. \u041f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0435\u043b\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, \u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u044f \u0441 Java. \u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 Java \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 JavaFX. \u0422\u043e\u0447\u043d\u0435\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0441\u0432\u044f\u0437\u043a\u0430 JavaFX + FXML, \u0433\u0434\u0435 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443, \u0430 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c fxml-\u0444\u0430\u0439\u043b\u0435. \u0420\u0430\u0434\u0438\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 JLayer. \u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 MediaPlayer \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0443 \u043c\u0435\u043d\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0417\u0430\u043f\u0438\u0441\u044c \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445. \u0420\u0430\u0434\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u043b\u0443\u0447\u0438\u043b \u043d\u0430\u043c\u0435\u0440\u0442\u0432\u043e \u0437\u0430\u0432\u0438\u0441\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435.<\/p>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 <a href=\"https:\/\/github.com\/kalexal-kaa\/RadioEng\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 GitHub<\/a>. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0440\u0435\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 NetBeans 8.2 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 Scene Builder \u043e\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Gluon. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u044f \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u043b\u0438\u0448\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445, \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445.<\/p>\n<h2>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434<\/h2>\n<p> \u0412\u043e\u0442 \u0442\u0430\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:  <\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p> \u0412 \u043c\u0435\u043d\u044e \u00abStation\u00bb \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0443\u043d\u043a\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u0438. \u0412 \u043c\u0435\u043d\u044e \u00abRecord\u00bb \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u043d\u043a\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u043c\u0435\u043d\u044e \u00abReference\u00bb \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043f\u0443\u043d\u043a\u0442 \u0434\u043b\u044f \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u043f\u0443\u043d\u043a\u0442 \u00ab\u041e \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\u00bb, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.  <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u044f \u0434\u0443\u043c\u0430\u044e, \u0438\u0437\u043b\u0438\u0448\u043d\u0438.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;  &lt;?import javafx.scene.control.Button?&gt; &lt;?import javafx.scene.control.Label?&gt; &lt;?import javafx.scene.control.ListView?&gt; &lt;?import javafx.scene.control.Menu?&gt; &lt;?import javafx.scene.control.MenuBar?&gt; &lt;?import javafx.scene.control.MenuItem?&gt; &lt;?import javafx.scene.layout.AnchorPane?&gt; &lt;?import javafx.scene.text.Font?&gt;  &lt;AnchorPane maxHeight=\"-Infinity\" maxWidth=\"-Infinity\" minHeight=\"-Infinity\" minWidth=\"-Infinity\" prefHeight=\"300.0\" prefWidth=\"535.0\" xmlns=\"http:\/\/javafx.com\/javafx\/8.0.171\" xmlns:fx=\"http:\/\/javafx.com\/fxml\/1\" fx:controller=\"radioplayer.PlayerController\"&gt;    &lt;ListView fx:id=\"stationsListView\" focusTraversable=\"false\" layoutX=\"14.0\" layoutY=\"36.0\" prefHeight=\"246.0\" prefWidth=\"200.0\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.leftAnchor=\"14.0\" AnchorPane.topAnchor=\"36.0\" \/&gt;    &lt;Button fx:id=\"playButton\" focusTraversable=\"false\" layoutX=\"240.0\" layoutY=\"177.0\" mnemonicParsing=\"false\" onAction=\"#playAction\" prefHeight=\"103.0\" prefWidth=\"130.0\" text=\"PLAY\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.rightAnchor=\"165.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold\" size=\"22.0\" \/&gt;       &lt;\/font&gt;&lt;\/Button&gt;    &lt;Button fx:id=\"stopButton\" focusTraversable=\"false\" layoutX=\"391.0\" layoutY=\"177.0\" mnemonicParsing=\"false\" onAction=\"#stopAction\" prefHeight=\"103.0\" prefWidth=\"130.0\" text=\"STOP\" AnchorPane.bottomAnchor=\"14.0\" AnchorPane.rightAnchor=\"14.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold\" size=\"22.0\" \/&gt;       &lt;\/font&gt;&lt;\/Button&gt;    &lt;Label fx:id=\"nameStation\" layoutX=\"240.0\" layoutY=\"46.0\" prefHeight=\"113.0\" prefWidth=\"279.0\" wrapText=\"true\" AnchorPane.bottomAnchor=\"141.0\" AnchorPane.rightAnchor=\"14.0\" AnchorPane.topAnchor=\"36.0\"&gt;       &lt;font&gt;          &lt;Font name=\"System Bold Italic\" size=\"24.0\" \/&gt;       &lt;\/font&gt;&lt;\/Label&gt;    &lt;MenuBar prefHeight=\"29.0\" prefWidth=\"535.0\" AnchorPane.leftAnchor=\"0.0\" AnchorPane.rightAnchor=\"0.0\" AnchorPane.topAnchor=\"0.0\"&gt;      &lt;menus&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Station\"&gt;          &lt;items&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#addAction\" text=\"Add\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#editAction\" text=\"Edit\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#deleteAction\" text=\"Delete\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Record\"&gt;          &lt;items&gt;            &lt;MenuItem fx:id=\"recordItem\" mnemonicParsing=\"false\" onAction=\"#recordAction\" text=\"To begin\" \/&gt;            &lt;MenuItem fx:id=\"stopRecordItem\" mnemonicParsing=\"false\" onAction=\"#stopRecordAction\" text=\"Stop\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#directoryRecordAction\" text=\"Records Directory\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;        &lt;Menu mnemonicParsing=\"false\" text=\"Reference\"&gt;          &lt;items&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#appInfoAction\" text=\"About the program\" \/&gt;            &lt;MenuItem mnemonicParsing=\"false\" onAction=\"#exitAction\" text=\"Exit\" \/&gt;          &lt;\/items&gt;        &lt;\/Menu&gt;      &lt;\/menus&gt;    &lt;\/MenuBar&gt; &lt;\/AnchorPane&gt;<\/code><\/pre>\n<p>\u0424\u0430\u0439\u043b \u0441\u0442\u0438\u043b\u0435\u0439 (toast \u044d\u0442\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041e \u043d\u0438\u0445 \u043f\u043e\u0437\u0436\u0435):  <\/p>\n<pre><code class=\"css\">.root{     -fx-background-color: grey; } .button{     -fx-background-radius: 40;     -fx-border-radius: 40;     -fx-text-fill: white; } .button:hover{     -fx-background-color: derive(-fx-base, 18%);     -fx-border-style: solid;     -fx-border-width: 1;     -fx-border-color: derive(-fx-base, -15%);     -fx-cursor: hand; } .button:pressed{     -fx-text-fill: black; } .list-view, .list-view .viewport, .list-view .content{     -fx-background-color: gainsboro; } .list-view:hover{     -fx-cursor: hand; } .toast{     -fx-background-radius: 30;     -fx-border-radius: 30;     -fx-background-color: black;     -fx-padding: 20; } #nameStation{     -fx-text-fill: white; } #playButton{     -fx-background-color: blue; } #stopButton{     -fx-background-color: red; }<\/code><\/pre>\n<h2>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c<\/h2>\n<p> \u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"java\">taskPlayer = new Task() {             @Override             public Void call() {                 try {                     radioUrl = new URL(urlString);                     InputStream in = radioUrl.openStream();                     InputStream is = new BufferedInputStream(in);                     player = new Player(is);                     player.play();                 } catch (FileNotFoundException e) {                     e.getMessage();                 } catch (IOException | JavaLayerException e) {                     e.getMessage();                 }                 return null;             }         };         new Thread(taskPlayer).start();<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c, \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 JLayer. \u0417\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"java\">taskRecord=new Task() {             @Override             public Void call() throws FileNotFoundException, IOException{                     output = new FileOutputStream(reader(file.getAbsolutePath())+                             separator+nameStation.getText()+\"-\"+new Date().toString().replace(\":\",\"-\")+\".mp3\");                     InputStream in = radioUrl.openStream();                     InputStream is = new BufferedInputStream(in);                     byte data[] = new byte[1024];                     int count;                     while ((count = is.read(data)) != -1) {                         output.write(data, 0, count);                     }                 output.flush();                 return null;             }         };         new Thread(taskRecord).start();<\/code><\/pre>\n<h2>\u0421\u0442\u0430\u043d\u0446\u0438\u0438<\/h2>\n<p> \u0421\u0442\u0430\u043d\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u0433\u0434\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0446\u0438\u0438, \u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e \u0435\u0435 URL. \u0412\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0446\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435:  <\/p>\n<pre><code class=\"java\">private void createDefaultStations(){          String[] stationNames = {\"NonStopPlay\",\"Classical Music\",\"Fip Radio\",\"Jazz Legends\",\"Joy Radio\",\"Live-icy\",\"Music Radio\",\"Radio Electron\",\"Dubstep\",\"Trancemission\"};          String[] stationUrls = {\"http:\/\/stream.nonstopplay.co.uk\/nsp-128k-mp3\",\"http:\/\/stream.srg-ssr.ch\/m\/rsc_de\/mp3_128\",\"http:\/\/direct.fipradio.fr\/live\/fip-midfi.mp3\",\"http:\/\/jazz128legends.streamr.ru\/\",\"http:\/\/airtime.joyradio.cc:8000\/airtime_192.mp3\",\"http:\/\/live-icy.gss.dr.dk:8000\/A\/A05H.mp3\",\"http:\/\/ice-the.musicradio.com\/CapitalXTRANationalMP3\",\"http:\/\/radio-electron.ru:8000\/128\",\"http:\/\/air.radiorecord.ru:8102\/dub_320\",\"http:\/\/air.radiorecord.ru:8102\/tm_320\"};          for(int i=0;i&lt;10;i++){              writer(path+separator+stationNames[i], stationUrls[i]);          }     }<\/code><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 dirCreator, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e RadioStations, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u0441\u0442\u0430\u043d\u0446\u0438\u0439. \u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434:  <\/p>\n<pre><code class=\"java\">private void dirCreator(final String fPath) {         final File file = new File(fPath);         if (!file.exists()) {             file.mkdir();             if(file.exists()){                 alertWindow(\"The &lt;RadioStations&gt; directory has been created.\\nYour radio stations will be here:\\n\"+fPath);                 createDefaultStations();             }else{                 alertWindow(\"Error!\\nThe &lt;RadioStations&gt; directory will not be created.\\n\" +                         \"Try creating the specified directory manually in the following path:\\n\"+fPath+\"\\nThe program will be closed.\");                 System.exit(0);             }         }     }<\/code><\/pre>\n<h2>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c<\/h2>\n<p> \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c. \u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0442\u043e \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e:  <\/p>\n<pre><code class=\"java\">private boolean permissionRead(File file){         if(!file.canRead()){             file.setReadable(true);             return !file.canRead();         }         return false;     }     private boolean permissionWrite(File file){         if(!file.canWrite()){             file.setWritable(true);             return !file.canWrite();         }         return false;     }<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u0430\u043f\u043a\u0438 RadioStations:  <\/p>\n<pre><code class=\"java\">@Override     public void initialize(URL url, ResourceBundle rb) {         parentPath = System.getProperty(\"user.home\");         path=parentPath+separator+\"RadioStations\";         this.dirCreator(this.path);         File f=new File(path);         if(permissionRead(f)||permissionWrite(f)){             if(permissionRead(f)&amp;&amp;permissionWrite(f)){                 alertWindow(\"Failed to get permission to read and write files to the &lt;RadioStations&gt; directory.\\nTry to give permission manually.\");             }else<\/code><\/pre>\n<\/div>\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-319914","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319914","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=319914"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319914\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}