javafx.stage.Window.setOnCloseRequest()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中javafx.stage.Window.setOnCloseRequest()方法的一些代码示例,展示了Window.setOnCloseRequest()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.setOnCloseRequest()方法的具体详情如下:
包路径:javafx.stage.Window
类名称:Window
方法名:setOnCloseRequest

Window.setOnCloseRequest介绍

暂无

代码示例

代码示例来源:origin: speedment/speedment

Window window = newVal.windowProperty().get();
if( window != null ){
  window.setOnCloseRequest( (ev) -> closeWindow() );
} else {
  newVal.windowProperty().addListener( (ob, oldW, newW) -> {
    newW.setOnCloseRequest( (ev) -> closeWindow() );
  });

代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx

final void start(Stage primaryStage, String callee) {
  BorderPane r = new BorderPane();
  Object[] arr = findInitialSize(callee);
  Scene scene = new Scene(r, (Double)arr[2], (Double)arr[3]);
  primaryStage.setScene(scene);
  this.root = r;
  this.stage = primaryStage;
  synchronized (FXBrwsr.class) {
    INSTANCE = this;
    FXBrwsr.class.notifyAll();
  }
  primaryStage.setX((Double)arr[0]);
  primaryStage.setY((Double)arr[1]);
  if (arr[4] != null) {
    scene.getWindow().setOnCloseRequest((EventHandler<WindowEvent>) arr[4]);
  }
  if (Boolean.getBoolean("fxpresenter.headless")) {
    return;
  }
  primaryStage.show();
}

相关文章