javafx, how to implement confirmHandler?

后端 未结 1 1979
暗喜
暗喜 2021-01-16 10:30

I\'m using javafx\'s webengine to display a web page. And on the page, there\'s script calling window.confirm. I already know how to set the confirm handler and how to show

相关标签:
1条回答
  • 2021-01-16 11:20

    As described in javafx-jira.kenai.com/browse/RT-19783, we can use the new method showAndWait which is available in JavaFx 2.2 to achieve this.

    Stage class:

    /** 
     * Show the stage and wait for it to be closed before returning to the 
     * caller. This must be called on the FX Application thread. The stage 
     * must not already be visible prior to calling this method. This must not 
     * be called on the primary stage. 
     * 
     * @throws IllegalStateException if this method is called on a thread 
     * other than the JavaFX Application Thread. 
     * @throws IllegalStateException if this method is called on the 
     * primary stage. 
     * @throws IllegalStateException if this stage is already showing. 
     */ 
    public void showAndWait();
    

    @jewelsea created a sample on https://gist.github.com/2992072. Thanks!

    0 讨论(0)
提交回复
热议问题