且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JavaFX阶段模式

更新时间:2023-12-04 20:31:46

替换

stage.initModality(Modality.WINDOW_MODAL);

stage.initModality(Modality.APPLICATION_MODAL);

前者阻止如下:

定义一个模式窗口,该窗口阻止事件传递给它 整个所有者窗口层次结构.

Defines a modal window that block events from being delivered to its entire owner window hierarchy.

而后者:

定义一个模式窗口,该窗口阻止事件传递给任何事件 其他应用程序窗口.

Defines a modal window that blocks events from being delivered to any other application window.

来源: https://docs.oracle. com/javase/8/javafx/api/javafx/stage/Modality.html

根据您为什么要实现上述行为,您可能需要使用

Depending on why you want to achieve the aforementioned behaviour you might want to use JavaFX 8 Dialog available from JDK 8 Update 40