{"id":287385,"date":"2018-08-16T14:08:07","date_gmt":"2018-08-16T10:08:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287385"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287385","title":{"rendered":"\u041e\u043a\u043e\u0448\u043a\u043e \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u043d\u0430 JavaFX:"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420003\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/u_\/up\/si\/u_upsi2jdx1s0cn_znkujxn472k.jpeg\">\u041f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>  \u041c\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043f\u043e\u0440 \u0431\u044b\u043b\u0438 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0448\u0435\u0440\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u044b \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0438 \u0441\u043e\u0442\u0432\u043e\u0440\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043a\u043e\u0448\u043a\u043e \u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u044d\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0435 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b; \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0443\u044e \u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c?<\/h4>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u0446\u0435\u043b\u044c \u0443 \u043c\u0435\u043d\u044f \u2014 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 JavaFX, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430. \u0418\u0434\u0435\u044f \u0442\u0430\u043a\u0430\u044f: \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0431\u043e\u0440 \u043b\u044e\u0434\u0435\u0439 (\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438), \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0438\u043c\u044f, \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0430 \u0438 \u0441\u0435\u043c\u0435\u0439\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u0430\u0448\u0435 \u043e\u043a\u043d\u043e, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u0443 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430, \u0432-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430, \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432-\u0447\u0435\u0442\u0432\u0435\u0440\u043d\u044b\u0445, \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u043f\u043e \u0442\u0438\u043f\u0443 \u044d\u0442\u043e\u0433\u043e: <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bp\/wc\/hp\/bpwchpa8rwm6xse8zmisb9dyjac.jpeg\"><\/p>\n<h4>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u043e-\u043d\u0430\u043f\u0435\u0440\u0432\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Company, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"java\">package company;  public class Company {  \tpublic static void main(String[] args) { \t\t  \t}  }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0431\u0443\u0434\u0435\u043c <i>\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c<\/i> \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 Application. \u0418\u0437 \u043d\u0435\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u0435\u0442\u043e\u0434 start(), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 (\u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435; \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043d\u0430\u0448\u0435 \u043e\u043a\u043d\u043e \u043d\u0435 \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f, \u043d\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f StackTrace \u043e\u0448\u0438\u0431\u043a\u0438):<\/p>\n<pre><code class=\"java\">package company;  import javafx.application.Application; import javafx.stage.Stage;  public class Company extends Application { \t \tpublic void start(Stage primaryStage) throws Exception { \t\t \t}  \tpublic static void main(String[] args) { \t\tlaunch(args); \t}  }<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441 User: \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u0440\u043e\u043b\u0438 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 User<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package company;  public class User {  \tUser(String name, int age, int salary, boolean married) { \t\tthis.name = name; \t\tthis.age = age; \t\tthis.salary = salary; \t\tthis.married = married; \t} \t \tpublic void changeSalary(int x) { \t\tsalary = (salary + x &lt;= 0)? 0: salary + x; \t} \t \tpublic String toString() { \t\treturn name; \t} \t \tpublic String getAge() { \t\treturn String.valueOf(age); \t} \t \tpublic String getSalary() { \t\treturn String.valueOf(salary); \t} \tpublic String getMarried() { \t\treturn (married)? (\"married\"):(\"single\"); \t} \t \tString name; \tint age; \tint salary; \tboolean married; }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c<\/h4>\n<p>  \u041f\u043e\u043a\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u043a\u043e\u0448\u0435\u0447\u043a\u043e, \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c. \u042d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<pre><code class=\"java\">package company;  import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.stage.Stage;  public class Company extends Application { \t \tpublic void start(Stage primaryStage) throws Exception { \t\tScene scene = new Scene(root, WIDTH, HEIGHT); \t\tprimaryStage.setTitle(\"Company\"); \t\tprimaryStage.setScene(scene); \t\tprimaryStage.show(); \t}  \tpublic static void main(String[] args) { \t\tlaunch(args); \t} \t \tGroup root = new Group(); \t \tfinal private int WIDTH = 1000; \tfinal private int HEIGHT = 600;  }<\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438: \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0441\u0446\u0435\u043d\u0443 (scene) \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b25\/fa0\/75b\/b25fa075bbc630bffd5a8ac3f5157092.svg\" alt=\"$WIDTH\\times HEIGHT$\" data-tex=\"inline\"><\/math>, \u0434\u0430\u043b\u0438 \u0435\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u00abCompany\u00bb. \u041d\u0430 \u043d\u0430\u0448\u0435\u0439 \u0441\u0446\u0435\u043d\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u0430 <i>root<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u00ab\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u043a\u043d\u043e\u043f\u043a\u0438. <\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430\u043c\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c HBox, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u043d\u0430\u0448 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a ComboBox userBox \u0438 \u043a\u043d\u043e\u043f\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0435 (\u0441\u0430\u043c HBox \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0432 VBox):<\/p>\n<pre><code class=\"java\">package company;  import java.util.ArrayList;  import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.stage.Stage;  public class Company extends Application {  \tpublic void start(Stage primaryStage) throws Exception {  \t\tusers.add(new User(\"Alice\", 20, 150, false)); \t\tusers.add(new User(\"Bob\", 34, 300, true)); \t\tusers.add(new User(\"Peter\", 18, 100, false)); \t\tusers.add(new User(\"Kate\", 38, 300, true)); \t\tusers.add(new User(\"Steve\", 31, 250, true)); \t\tusers.add(new User(\"Alan\", 62, 500, true)); \t\tusers.add(new User(\"Julia\", 33, 320, true)); \t\tusers.add(new User(\"Patric\", 37, 300, true)); \t\tusers.add(new User(\"Alexander\", 34, 280, true)); \t\tusers.add(new User(\"George\", 28, 180, true)); \t\tusers.add(new User(\"Mary\", 22, 190, false));  \t\tuserBox.getItems().addAll(users);  \t\troot.getChildren().add(strings);  \t\tstrings.setPadding(new Insets(10, 30, 10, 30)); \t\tstrings.setSpacing(20);  \t\tstrings.getChildren().add(new Text(\"Select the user\")); \t\tstrings.getChildren().add(buttonBox); \t\t \t\tbuttonBox.setSpacing(10); \t\tbuttonBox.getChildren().add(userBox);  \t\tScene scene = new Scene(root, WIDTH, HEIGHT); \t\tprimaryStage.setTitle(\"Company\"); \t\tprimaryStage.setScene(scene); \t\tprimaryStage.show(); \t}  \tpublic static void main(String[] args) { \t\tlaunch(args); \t}  \tGroup root = new Group();  \tVBox strings = new VBox();  \tHBox buttonBox = new HBox();  \tComboBox&lt;User&gt; userBox = new ComboBox&lt;&gt;();  \tfinal private int WIDTH = 1000; \tfinal private int HEIGHT = 600;  \tprivate ArrayList&lt;User&gt; users = new ArrayList&lt;&gt;();  } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/d3\/ik\/pt\/d3ikptwyrpa4nx7bdtpcy_d3kn8.jpeg\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 VBox,HBox \u0438 ComboBox<\/b><\/p>\n<div class=\"spoiler_text\">  HBox \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043a\u043d\u043e\u043f\u043e\u043a, \u0442\u0435\u043a\u0441\u0442\u043e\u0432, \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0435\u043c\u0443, VBox \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c \u0436\u0435 \u0441\u0430\u043c\u044b\u043c, \u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0432\u043e\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b (children) \u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0445\u0435\u043c\u0443: \u0441\u043e\u0437\u0434\u0430\u0442\u0438\u043c VBox, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e HBox&#8217;\u043e\u0432, \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  ComboBox \u2014 \u044d\u0442\u043e \u0441\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0435. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0430\u043c\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 (Button) \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 (TextField), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0442\u0435\u043a\u0441\u0442. \u042d\u0442\u0438 \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 HBox: <\/p>\n<pre><code class=\"java\">package company;  \/* *\/  public class Company extends Application {  \tpublic void start(Stage primaryStage) throws Exception {  \t\t\/* *\/ \t\t \t\tbuttonBox.setSpacing(10); \t\tbuttonBox.getChildren().add(userBox); \t\tbuttonBox.getChildren().add(buttonGetInfo); \t\tbuttonBox.getChildren().add(textInfo);  \t\t\/* *\/ \t}  \t\/* *\/ \t \tButton buttonGetInfo = new Button(\"Info\"); \tText textInfo = new Text();          \/* *\/  }<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ki\/4j\/n1\/ki4jn14cxwit0llj7oaqdas8imu.jpeg\"><\/p>\n<p>  \u041d\u043e \u043f\u043e\u043a\u0430 \u044d\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442. \u0427\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0439 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435: <\/p>\n<pre><code class=\"java\">buttonGetInfo.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t@Override \tpublic void handle(ActionEvent e) { \t\tUser u = (User) userBox.getSelectionModel().getSelectedItem(); \t\tif (u != null) { \t\t\ttextInfo.setText(\"Age is \" + u.getAge() + \", \" +  \t\t\t \"Salary is \" + u.getSalary() + \", \" +  \t\t\t \"Relationship: \" + u.getMarried()); \t\t} else { \t\t\ttextInfo.setText(\"User not selected\"); \t\t} \t} }); <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/97\/yb\/20\/97yb20ksp7zwu6o8iknmecjtcfs.jpeg\"><\/p>\n<h4>\u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/h4>\n<p>  \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0435 \u0434\u0432\u0430 HBox&#8217;\u0430: \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b, \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430. \u0412 \u0441\u0438\u043b\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430 \u0436\u0435 \u0441\u0430\u043c\u0430\u044f, \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fu\/ln\/rl\/fulnrlvqo_pd46yaksihqvi3vre.jpeg\"><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"java\">package company;  import java.util.ArrayList;  import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.stage.Stage;  public class Company extends Application {  \tpublic void start(Stage primaryStage) throws Exception {  \t\tusers.add(new User(\"Alice\", 20, 150, false)); \t\tusers.add(new User(\"Bob\", 34, 300, true)); \t\tusers.add(new User(\"Peter\", 18, 100, false)); \t\tusers.add(new User(\"Kate\", 38, 300, true)); \t\tusers.add(new User(\"Steve\", 31, 250, true)); \t\tusers.add(new User(\"Alan\", 62, 500, true)); \t\tusers.add(new User(\"Julia\", 33, 320, true)); \t\tusers.add(new User(\"Patric\", 37, 300, true)); \t\tusers.add(new User(\"Alexander\", 34, 280, true)); \t\tusers.add(new User(\"George\", 28, 180, true)); \t\tusers.add(new User(\"Mary\", 22, 190, false));  \t\tuserBox.getItems().addAll(users);  \t\troot.getChildren().add(strings);  \t\tstrings.setPadding(new Insets(10, 30, 10, 30)); \t\tstrings.setSpacing(20);  \t\tstrings.getChildren().add(new Text(\"Select the user\")); \t\tstrings.getChildren().add(buttonBox); \t\tstrings.getChildren().add(new Text(\"Change the salary\")); \t\tstrings.getChildren().add(changeSalaryBox); \t\tstrings.getChildren().add(new Text(\"Add new User\")); \t\tstrings.getChildren().add(addUserBox);  \t\tbuttonBox.setSpacing(10); \t\tbuttonBox.getChildren().add(userBox); \t\tbuttonBox.getChildren().add(buttonGetInfo); \t\tbuttonBox.getChildren().add(textInfo); \t\t \t\tchangeSalaryBox.setSpacing(10); \t\tchangeSalaryBox.getChildren().add(buttonChangeSalary); \t\tchangeSalaryBox.getChildren().add(howMuchChange); \t\t \t\taddUserBox.setSpacing(10); \t\taddUserBox.getChildren().add(new Text(\"Name: \")); \t\taddUserBox.getChildren().add(name); \t\taddUserBox.getChildren().add(new Text(\"Age: \")); \t\taddUserBox.getChildren().add(age); \t\taddUserBox.getChildren().add(new Text(\"Salary: \")); \t\taddUserBox.getChildren().add(salary); \t\taddUserBox.getChildren().add(new Text(\"Married: \")); \t\taddUserBox.getChildren().add(married); \t\taddUserBox.getChildren().add(buttonAddUser); \t\t \t\tbuttonGetInfo.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tUser u = (User) userBox.getSelectionModel().getSelectedItem(); \t\t\t\tif (u != null) { \t\t\t\t\ttextInfo.setText(\"Age is \" + u.getAge() + \", \" +  \t\t\t\t\t\t\t\t\t \"Salary is \" + u.getSalary() + \", \" +  \t\t\t\t\t\t\t\t\t \"Relationship: \" + u.getMarried()); \t\t\t\t} else { \t\t\t\t\ttextInfo.setText(\"User not selected\"); \t\t\t\t} \t\t\t} \t\t});  \t\t \t\tbuttonChangeSalary.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\t \t\t\t\tUser u = (User) userBox.getSelectionModel().getSelectedItem(); \t\t\t\tif(u != null) { \t\t\t\t\tu.changeSalary(Integer.parseInt(howMuchChange.getText())); \t\t\t\t\ttextInfo.setText(\"Age is \" + u.getAge() + \", \" +  \t\t\t\t\t\t\t \"Salary is \" + u.getSalary() + \", \" +  \t\t\t\t\t\t\t \"Relationshp: \" + u.getMarried()); \t\t\t\t\thowMuchChange.clear(); \t\t\t\t}   \t\t\t} \t\t}); \t\t \t\tbuttonAddUser.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tString m = married.getText(); \t\t\t\tboolean mm = (m.equals(\"married\"))? true:false; \t\t\t\tUser u = new User(name.getText(), Integer.parseInt(age.getText()),  \t\t\t\t\t\t\t\t\t\tInteger.parseInt(salary.getText()), mm); \t\t\t\tusers.add(u); \t\t\t\tuserBox.getItems().addAll(u); \t\t\t\tname.clear(); \t\t\t\tage.clear(); \t\t\t\tsalary.clear(); \t\t\t\tmarried.clear(); \t\t\t} \t\t});  \t\tScene scene = new Scene(root, WIDTH, HEIGHT); \t\tprimaryStage.setTitle(\"Company\"); \t\tprimaryStage.setScene(scene); \t\tprimaryStage.show(); \t}  \tpublic static void main(String[] args) { \t\tlaunch(args); \t}  \tGroup root = new Group();  \tVBox strings = new VBox();  \tHBox buttonBox = new HBox(); \tComboBox&lt;User&gt; userBox = new ComboBox&lt;&gt;(); \tButton buttonGetInfo = new Button(\"Info\"); \tText textInfo = new Text(); \t \tHBox changeSalaryBox = new HBox(); \tButton buttonChangeSalary = new Button(\"Change salary\"); \tTextField howMuchChange = new TextField(); \t \tHBox addUserBox = new HBox(); \tButton buttonAddUser = new Button(\"Add User\"); \tTextField name = new TextField(); \tTextField age = new TextField(); \tTextField salary = new TextField(); \tTextField married = new TextField();  \tfinal private int WIDTH = 1000; \tfinal private int HEIGHT = 600;  \tprivate ArrayList&lt;User&gt; users = new ArrayList&lt;&gt;();  } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0424\u0438\u043b\u044c\u0442\u0440\u044b<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u00ab\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e\u00bb \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u043f\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c. \u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c ComboBox \u043f\u043e \u0442\u043e\u0439 \u0436\u0435 \u0441\u0430\u043c\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435.<\/p>\n<pre><code class=\"java\">package company;  \/* *\/  public class Company extends Application {  \tpublic void start(Stage primaryStage) throws Exception {  \t\t\/* *\/ \t\t \t\tageFilterBox.getItems().addAll( \t\t\t\t\"no matter\",  \t\t\t\t\"over 20\", \t\t\t\t\"over 30\",  \t\t\t\t\"over 40\" \t\t\t\t); \t\t \t\tsalaryFilterBox.getItems().addAll(  \t\t\t\t\"no matter\", \t\t\t\t\"over 150\", \t\t\t\t\"over 250\", \t\t\t\t\"over 500\" \t\t\t\t); \t\t \t\trelationshipFilterBox.getItems().addAll(  \t\t\t\t\"no matter\", \t\t\t\t\"married\", \t\t\t\t\"single\" \t\t\t\t);   \t\t\/* *\/ \t\tstrings.getChildren().add(filters); \t\tstrings.getChildren().add(resultFilter);  \t\t\/* *\/ \t\t \t\tfilters.setSpacing(10); \t\tfilters.getChildren().add(new Text(\"Age\")); \t\tfilters.getChildren().add(ageFilterBox); \t\tfilters.getChildren().add(new Text(\"Salary\")); \t\tfilters.getChildren().add(salaryFilterBox); \t\tfilters.getChildren().add(new Text(\"Relationship\")); \t\tfilters.getChildren().add(relationshipFilterBox); \t\tfilters.getChildren().add(filter); \t\t \t\t\/* *\/ \t\t \t\tfilter.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tint age; \t\t\t\tint index = ageFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\tage = (index == 0)? 0: (index == 1)? 21: (index == 2)? 31: 41; \t\t\t\t \t\t\t\tint salary; \t\t\t\tindex = salaryFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\tsalary = (index == 0)? 0 : (index == 1)? 151 : (index == 2)? 251:501; \t\t\t\t \t\t\t\tboolean relate; \t\t\t\tindex = relationshipFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\trelate = (index == 1)? true: (index == 2)? false: true; \t\t\t\t \t\t\t\tList&lt;User&gt; list; \t\t\t\tif(index != 0) {  list = users.stream(). \t\t\t\tfilter(u -&gt; u.age &gt; age). \t\t\t\tfilter(u -&gt; u.salary &gt; salary). \t\t\t\tfilter(u -&gt; u.married == relate). \t\t\t\tcollect(Collectors.toList()); } \t\t\t\t \t\t\t\telse { list = users.stream(). \t\t\t\tfilter(u -&gt; u.age &gt; age). \t\t\t\tfilter(u -&gt; u.salary &gt; salary). \t\t\t\tcollect(Collectors.toList()); } \t\t\t\t \t\t\t\tString res = \"\"; \t\t\t\tfor(User u: list) { \t\t\t\t\tres += u.toString() + \", \"; \t\t\t\t} \t\t\t\t \t\t\t\tresultFilter.setText(res); \t\t\t\t \t\t\t} \t\t});  \t\t\/* *\/ \t}  \t\/* *\/ \t \tHBox filters = new HBox(); \tComboBox&lt;String&gt; ageFilterBox = new ComboBox&lt;&gt;(); \tComboBox&lt;String&gt; salaryFilterBox = new ComboBox&lt;&gt;(); \tComboBox&lt;String&gt; relationshipFilterBox = new ComboBox&lt;&gt;(); \tButton filter = new Button(\"filter\"); \tText resultFilter = new Text();  \t\/* *\/  } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bp\/wc\/hp\/bpwchpa8rwm6xse8zmisb9dyjac.jpeg\"><\/p>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e!<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041a\u043b\u0430\u0441\u0441 Company (\u0433\u043b\u0430\u0432\u043d\u044b\u0439) <\/p>\n<pre><code class=\"java\">package company;  import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors;  import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.TextField; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Text; import javafx.stage.Stage;  public class Company extends Application {  \t@Override \tpublic void start(Stage primaryStage) throws Exception {  \t\tusers.add(new User(\"Alice\", 20, 150, false)); \t\tusers.add(new User(\"Bob\", 34, 300, true)); \t\tusers.add(new User(\"Peter\", 18, 100, false)); \t\tusers.add(new User(\"Kate\", 38, 300, true)); \t\tusers.add(new User(\"Steve\", 31, 250, true)); \t\tusers.add(new User(\"Alan\", 62, 500, true)); \t\tusers.add(new User(\"Julia\", 33, 320, true)); \t\tusers.add(new User(\"Patric\", 37, 300, true)); \t\tusers.add(new User(\"Alexander\", 34, 280, true)); \t\tusers.add(new User(\"George\", 28, 180, true)); \t\tusers.add(new User(\"Mary\", 22, 190, false));  \t\tuserBox.getItems().addAll(users); \t\t \t\tageFilterBox.getItems().addAll( \t\t\t\t\"no matter\",  \t\t\t\t\"over 20\", \t\t\t\t\"over 30\",  \t\t\t\t\"over 40\" \t\t\t\t); \t\t \t\tsalaryFilterBox.getItems().addAll(  \t\t\t\t\"no matter\", \t\t\t\t\"over 150\", \t\t\t\t\"over 250\", \t\t\t\t\"over 500\" \t\t\t\t); \t\t \t\trelationshipFilterBox.getItems().addAll(  \t\t\t\t\"no matter\", \t\t\t\t\"married\", \t\t\t\t\"single\" \t\t\t\t);  \t\troot.getChildren().add(strings); \t\t \t\tstrings.setPadding(new Insets(10, 30, 10, 30)); \t\tstrings.setSpacing(20); \t\t \t\tstrings.getChildren().add(new Text(\"Select the user\")); \t\tstrings.getChildren().add(buttonBox); \t\tstrings.getChildren().add(new Text(\"Change the salary\")); \t\tstrings.getChildren().add(changeSalaryBox); \t\tstrings.getChildren().add(new Text(\"Add new User\")); \t\tstrings.getChildren().add(addUserBox); \t\tstrings.getChildren().add(filters); \t\tstrings.getChildren().add(resultFilter);  \t\tbuttonBox.setSpacing(10); \t\tbuttonBox.getChildren().add(userBox); \t\tbuttonBox.getChildren().add(buttonGetInfo); \t\tbuttonBox.getChildren().add(textInfo); \t\t \t\tchangeSalaryBox.setSpacing(10); \t\tchangeSalaryBox.getChildren().add(buttonChangeSalary); \t\tchangeSalaryBox.getChildren().add(howMuchChange); \t\t \t\taddUserBox.setSpacing(10); \t\taddUserBox.getChildren().add(new Text(\"Name: \")); \t\taddUserBox.getChildren().add(name); \t\taddUserBox.getChildren().add(new Text(\"Age: \")); \t\taddUserBox.getChildren().add(age); \t\taddUserBox.getChildren().add(new Text(\"Salary: \")); \t\taddUserBox.getChildren().add(salary); \t\taddUserBox.getChildren().add(new Text(\"Married: \")); \t\taddUserBox.getChildren().add(married); \t\taddUserBox.getChildren().add(buttonAddUser); \t\t \t\tfilters.setSpacing(10); \t\tfilters.getChildren().add(new Text(\"Age\")); \t\tfilters.getChildren().add(ageFilterBox); \t\tfilters.getChildren().add(new Text(\"Salary\")); \t\tfilters.getChildren().add(salaryFilterBox); \t\tfilters.getChildren().add(new Text(\"Relationship\")); \t\tfilters.getChildren().add(relationshipFilterBox); \t\tfilters.getChildren().add(filter); \t\t  \t\tScene scene = new Scene(root, WIDTH, HEIGHT); \t\tprimaryStage.setTitle(\"Company\"); \t\tprimaryStage.setScene(scene); \t\tprimaryStage.show();  \t\tbuttonGetInfo.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tUser u = (User) userBox.getSelectionModel().getSelectedItem(); \t\t\t\tif (u != null) { \t\t\t\t\ttextInfo.setText(\"Age is \" + u.getAge() + \", \" +  \t\t\t\t\t\t\t\t\t \"Salary is \" + u.getSalary() + \", \" +  \t\t\t\t\t\t\t\t\t \"Relationship: \" + u.getMarried()); \t\t\t\t} else { \t\t\t\t\ttextInfo.setText(\"User not selected\"); \t\t\t\t} \t\t\t} \t\t});  \t\t \t\tbuttonChangeSalary.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\t \t\t\t\tUser u = (User) userBox.getSelectionModel().getSelectedItem(); \t\t\t\tif(u != null) { \t\t\t\t\tu.changeSalary(Integer.parseInt(howMuchChange.getText())); \t\t\t\t\ttextInfo.setText(\"Age is \" + u.getAge() + \", \" +  \t\t\t\t\t\t\t \"Salary is \" + u.getSalary() + \", \" +  \t\t\t\t\t\t\t \"Relationshp: \" + u.getMarried()); \t\t\t\t\thowMuchChange.clear(); \t\t\t\t}   \t\t\t} \t\t}); \t\t \t\tbuttonAddUser.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tString m = married.getText(); \t\t\t\tboolean mm = (m.equals(\"married\"))? true:false; \t\t\t\tUser u = new User(name.getText(), Integer.parseInt(age.getText()),  \t\t\t\t\t\t\t\t\t\tInteger.parseInt(salary.getText()), mm); \t\t\t\tusers.add(u); \t\t\t\tuserBox.getItems().addAll(u); \t\t\t\tname.clear(); \t\t\t\tage.clear(); \t\t\t\tsalary.clear(); \t\t\t\tmarried.clear(); \t\t\t} \t\t}); \t\t \t\tfilter.setOnAction(new EventHandler&lt;ActionEvent&gt;() { \t\t\t@Override \t\t\tpublic void handle(ActionEvent e) { \t\t\t\tint age; \t\t\t\tint index = ageFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\tage = (index == 0)? 0: (index == 1)? 21: (index == 2)? 31: 41; \t\t\t\t \t\t\t\tint salary; \t\t\t\tindex = salaryFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\tsalary = (index == 0)? 0 : (index == 1)? 151 : (index == 2)? 251:501; \t\t\t\t \t\t\t\tboolean relate; \t\t\t\tindex = relationshipFilterBox.getSelectionModel().getSelectedIndex(); \t\t\t\trelate = (index == 1)? true: (index == 2)? false: true; \t\t\t\t \t\t\t\t\/\/resultFilter.setText(String.valueOf(age)  + \" \" + String.valueOf(salary)  + \" \"+ relate); \t\t\t\t \t\t\t\tList&lt;User&gt; list; \t\t\t\tif(index != 0) {  list = users.stream(). \t\t\t\tfilter(u -&gt; u.age &gt; age). \t\t\t\tfilter(u -&gt; u.salary &gt; salary). \t\t\t\tfilter(u -&gt; u.married == relate). \t\t\t\tcollect(Collectors.toList()); } \t\t\t\t \t\t\t\telse { list = users.stream(). \t\t\t\tfilter(u -&gt; u.age &gt; age). \t\t\t\tfilter(u -&gt; u.salary &gt; salary). \t\t\t\tcollect(Collectors.toList()); } \t\t\t\t \t\t\t\tString res = \"\"; \t\t\t\tfor(User u: list) { \t\t\t\t\tres += u.toString() + \", \"; \t\t\t\t} \t\t\t\t \t\t\t\tresultFilter.setText(res); \t\t\t\t \t\t\t} \t\t});  \t}  \tpublic static void main(String[] args) { \t\tlaunch(args); \t}  \tGroup root = new Group(); \t \tVBox strings = new VBox(); \t \tHBox buttonBox = new HBox(); \tHBox changeSalaryBox = new HBox(); \tHBox addUserBox = new HBox(); \tHBox filters = new HBox(); \t \tComboBox&lt;User&gt; userBox = new ComboBox&lt;&gt;(); \tComboBox&lt;String&gt; ageFilterBox = new ComboBox&lt;&gt;(); \tComboBox&lt;String&gt; salaryFilterBox = new ComboBox&lt;&gt;(); \tComboBox&lt;String&gt; relationshipFilterBox = new ComboBox&lt;&gt;();  \tfinal private int WIDTH = 1000; \tfinal private int HEIGHT = 600;  \tprivate ArrayList&lt;User&gt; users = new ArrayList&lt;&gt;();  \tButton buttonGetInfo = new Button(\"Info\"); \tText textInfo = new Text(); \t \tButton buttonChangeSalary = new Button(\"Change salary\"); \tTextField howMuchChange = new TextField(); \t \tButton buttonAddUser = new Button(\"Add User\"); \tTextField name = new TextField(); \tTextField age = new TextField(); \tTextField salary = new TextField(); \tTextField married = new TextField(); \t \tButton filter = new Button(\"filter\"); \tText resultFilter = new Text();  } <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 User <\/p>\n<pre><code class=\"java\">package company;  public class User {  \tUser(String name, int age, int salary, boolean married) { \t\tthis.name = name; \t\tthis.age = age; \t\tthis.salary = salary; \t\tthis.married = married; \t} \t \tpublic void changeSalary(int x) { \t\tsalary = (salary + x &lt;= 0)? 0: salary + x; \t} \t \tpublic String toString() { \t\treturn name; \t} \t \tpublic String getAge() { \t\treturn String.valueOf(age); \t} \t \tpublic String getSalary() { \t\treturn String.valueOf(salary); \t} \tpublic String getMarried() { \t\treturn (married)? (\"married\"):(\"single\"); \t} \t \tString name; \tint age; \tint salary; \tboolean married; } <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<h4>\u0427\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e<\/h4>\n<p>  \u0421\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u044b\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 <u>\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/u> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 JavaFX \u0438 \u0435\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u0412 \u043d\u0435\u043a\u043e\u0442\u0440\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b, \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430: \u0432 \u044d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435\u0439, \u043a\u0443\u0434\u0430 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432. \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u00ab\u043e\u0431\u0445\u043e\u0434\u00bb \u044d\u0442\u0438\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432. <\/p>\n<p>  \u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043a\u0441\u0442\u0430\u0442\u0438, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043d\u0435\u0431\u0435\u0437\u044b\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 StreamAPI \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b1b\/c57\/ea8\/b1bc57ea859ea7d6505ec3a3ae9be2f6.svg\" alt=\"$\\lambda$\" data-tex=\"inline\"><\/math>-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u044e\u0442 \u043a\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u0432 \u043d\u0435\u0433\u043e \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u0441\u0432\u043e\u0439 \u0448\u0430\u0440\u043c. <\/p>\n<p>  <b>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/b><\/p>\n<ol>\n<li><a href=\"https:\/\/docs.oracle.com\/javase\/8\/javafx\/api\/toc.htm\">JavaFX 8 \u2014 Oracle Help Center<\/a> <\/li>\n<li>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438 \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u0445 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/JavaFX\">JavaFX<\/a><\/li>\n<li> \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f <a href=\"https:\/\/habr.com\/company\/luxoft\/blog\/270383\/\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> <a href=\"https:\/\/habr.com\/users\/vedenin1980\/\" class=\"user_link\">vedenin1980<\/a> \u043f\u0440\u043e StreamAPI \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b1b\/c57\/ea8\/b1bc57ea859ea7d6505ec3a3ae9be2f6.svg\" alt=\"$\\lambda$\" data-tex=\"inline\"><\/math>-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f  <\/li>\n<\/ol>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/420003\/\"> https:\/\/habr.com\/post\/420003\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420003\/\" class=\"post__text post__text-html js-mediator-article\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/u_\/up\/si\/u_upsi2jdx1s0cn_znkujxn472k.jpeg\">\u041f\u0440\u0438\u0432\u0435\u0442! <\/p>\n<p>  \u041c\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043e \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043f\u043e\u0440 \u0431\u044b\u043b\u0438 \u043d\u0443\u043b\u0435\u0432\u044b\u043c\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0448\u0435\u0440\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u044b \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0438 \u0441\u043e\u0442\u0432\u043e\u0440\u0438\u0442\u044c \u043a\u0430\u043a\u043e\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043a\u043e\u0448\u043a\u043e \u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438, \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u044d\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u0439\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0438\u0435 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b; \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0443\u044e \u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443.   <\/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-287385","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287385","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=287385"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287385\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}