<legend id='RQS3B'><style id='RQS3B'><dir id='RQS3B'><q id='RQS3B'></q></dir></style></legend>

    1. <tfoot id='RQS3B'></tfoot>

        • <bdo id='RQS3B'></bdo><ul id='RQS3B'></ul>

        <i id='RQS3B'><tr id='RQS3B'><dt id='RQS3B'><q id='RQS3B'><span id='RQS3B'><b id='RQS3B'><form id='RQS3B'><ins id='RQS3B'></ins><ul id='RQS3B'></ul><sub id='RQS3B'></sub></form><legend id='RQS3B'></legend><bdo id='RQS3B'><pre id='RQS3B'><center id='RQS3B'></center></pre></bdo></b><th id='RQS3B'></th></span></q></dt></tr></i><div id='RQS3B'><tfoot id='RQS3B'></tfoot><dl id='RQS3B'><fieldset id='RQS3B'></fieldset></dl></div>

        <small id='RQS3B'></small><noframes id='RQS3B'>

        JavaFX 创建警报并获得结果

        JavaFX create alert and get result(JavaFX 创建警报并获得结果)
        • <small id='OEco6'></small><noframes id='OEco6'>

            <legend id='OEco6'><style id='OEco6'><dir id='OEco6'><q id='OEco6'></q></dir></style></legend>
              <bdo id='OEco6'></bdo><ul id='OEco6'></ul>

                • <i id='OEco6'><tr id='OEco6'><dt id='OEco6'><q id='OEco6'><span id='OEco6'><b id='OEco6'><form id='OEco6'><ins id='OEco6'></ins><ul id='OEco6'></ul><sub id='OEco6'></sub></form><legend id='OEco6'></legend><bdo id='OEco6'><pre id='OEco6'><center id='OEco6'></center></pre></bdo></b><th id='OEco6'></th></span></q></dt></tr></i><div id='OEco6'><tfoot id='OEco6'></tfoot><dl id='OEco6'><fieldset id='OEco6'></fieldset></dl></div>
                  <tfoot id='OEco6'></tfoot>
                    <tbody id='OEco6'></tbody>
                  本文介绍了JavaFX 创建警报并获得结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  对于我的 CS 课程,他们要求我们使用 JavaFX 警报.我可以发出警报,但是如何获取单击了哪个按钮?获取这些数据的最佳方法是什么?

                  For my CS class they require us to use JavaFX alerts. I can make an alert appear, but how do I get what button was clicked? What would be the best way to go about getting this data?

                  如果可能的话,我想让它有一个下拉面板,当用户选择和选项时,警报会关闭并打印用户选择的内容.

                  Also if possible, I'd like to make it have a drop down panel and when the user selects and option the alert closes and prints what the user selected.

                  这是我拥有的一些示例代码.当我单击其中一个按钮时,它只会关闭对话框.

                  Here's some example code that I have. When I click one of the buttons, it just closes the dialog.

                  Alert a = new Alert(AlertType.NONE, "Promote pawn to:", new ButtonType("Queen"), new ButtonType("Rook"));
                  a.setTitle("Title");
                  a.setHeaderText("My header text");
                  a.setResizable(true);
                  a.setContentText("Content text");
                  a.showAndWait();
                  

                  谢谢,

                  推荐答案

                  你可以做

                  ButtonType queen = new ButtonType("Queen");
                  ButtonType rook = new ButtonType("Rook");
                  Alert a = new Alert(AlertType.NONE, "Promote pawn to:", queen, rook);
                  a.setTitle("Title");
                  a.setHeaderText("My header text");
                  a.setResizable(true);
                  a.setContentText("Content text");
                  a.showAndWait().ifPresent(response -> {
                      if (response == queen) {
                          // promote to queen...
                      } else if (response == rook) {
                          // promote to rook...
                      }
                  });
                  

                  这篇关于JavaFX 创建警报并获得结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)

                  <small id='wX5zv'></small><noframes id='wX5zv'>

                      <tfoot id='wX5zv'></tfoot>

                        <tbody id='wX5zv'></tbody>
                      • <bdo id='wX5zv'></bdo><ul id='wX5zv'></ul>

                      • <legend id='wX5zv'><style id='wX5zv'><dir id='wX5zv'><q id='wX5zv'></q></dir></style></legend>

                            <i id='wX5zv'><tr id='wX5zv'><dt id='wX5zv'><q id='wX5zv'><span id='wX5zv'><b id='wX5zv'><form id='wX5zv'><ins id='wX5zv'></ins><ul id='wX5zv'></ul><sub id='wX5zv'></sub></form><legend id='wX5zv'></legend><bdo id='wX5zv'><pre id='wX5zv'><center id='wX5zv'></center></pre></bdo></b><th id='wX5zv'></th></span></q></dt></tr></i><div id='wX5zv'><tfoot id='wX5zv'></tfoot><dl id='wX5zv'><fieldset id='wX5zv'></fieldset></dl></div>