本文整理匯總了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());
}