javafx - 设置禁用某些窗格以指定时间
问题描述
我在 BorderPane 上有井字游戏。在左侧我有简单的聊天。我想设置可能性在 5 秒后第一次发送另一条消息,即我想为聊天设置禁用 5 秒,但应用程序的其他部分必须工作。我怎样才能做到这一点。
@FXML
private GridPane mainGridPane; //here game
@FXML
private GridPane smileGridPane; //this I want stop for five second
解决方案
PauseTransition
带有onFinished
重新启用窗格的处理程序的 A 将起到作用:
smileGridPane.setDisable(true); // disable target pane
PauseTransition pause = new PauseTransition(Duration.seconds(5));
pause.setOnFinished(evt -> smileGridPane.setDisable(false)); // reenable target pane
pause.play();
推荐阅读
- tomcat - Kubernetes 服务 DNS 无法访问
- php - 停止旧的 XAMPP 后台进程
- serialization - 如何使用 Google 协议缓冲区创建通用反序列化器?使用 C#
- r - 如何生成 Z 检验,包括 expss 列中的变量总数?
- c++ - Arduino UNO 解决多个重叠的计时器循环
- javascript - Array.map 无法正常工作 Javascript ReactJs
- php - 在opencart html模块中使用php标签
- c - 每当我选择 2 时,如何设置 if 语句选项以使其正常工作?
- git - 哪些公共 Git 存储库服务支持 `--filter` 选项?
- python-3.x - 您可以从类中的方法创建实例吗?