本文整理汇总了Java中javafx.stage.Window.getScene方法的典型用法代码示例。如果您正苦于以下问题:Java Window.getScene方法的具体用法?Java Window.getScene怎么用?Java Window.getScene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Window
的用法示例。
在下文中一共展示了Window.getScene方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import javafx.stage.Window; //导入方法依赖的package包/类
/**
* Shows this dialog.
*
* @param owner the owner.
*/
@FXThread
public void show(@NotNull final Window owner) {
final Scene scene = owner.getScene();
if (scene instanceof EditorFXScene) {
final EditorFXScene editorFXScene = (EditorFXScene) scene;
final StackPane container = editorFXScene.getContainer();
container.setFocusTraversable(false);
}
focusOwner = scene.getFocusOwner();
dialog.initOwner(owner);
dialog.show();
dialog.requestFocus();
GAnalytics.sendPageView(getDialogId(), null, "/dialog/" + getDialogId());
GAnalytics.sendEvent(GAEvent.Category.DIALOG, GAEvent.Action.DIALOG_OPENED, getDialogId());
final JFXApplication application = JFXApplication.getInstance();
application.addWindow(dialog);
Platform.runLater(dialog::sizeToScene);
}
示例2: hide
import javafx.stage.Window; //导入方法依赖的package包/类
@FXThread
public void hide() {
final Duration duration = Duration.between(showedTime, LocalTime.now());
final int seconds = (int) duration.getSeconds();
final Window window = dialog.getOwner();
final Scene scene = window.getScene();
if (scene instanceof EditorFXScene) {
final EditorFXScene editorFXScene = (EditorFXScene) scene;
final StackPane container = editorFXScene.getContainer();
container.setFocusTraversable(true);
}
if (focusOwner != null) {
focusOwner.requestFocus();
}
dialog.hide();
final JFXApplication application = JFXApplication.getInstance();
application.removeWindow(dialog);
GAnalytics.sendEvent(GAEvent.Category.DIALOG, GAEvent.Action.DIALOG_CLOSED, getDialogId());
GAnalytics.sendTiming(GAEvent.Category.DIALOG, GAEvent.Label.SHOWING_A_DIALOG, seconds, getDialogId());
}