使用FXML最小化JavaFx窗口

使用FXML最小化JavaFx窗口,javafx,fxml,Javafx,Fxml,我是Javafx新手,我正在从事Javafx项目。我想最小化javafx窗口。 我使用primaryStage.initStyle(StageStyle.UNDECORATED)。我还想将clickevent添加到fxml中的imageview中。我认为这对您很有用 imgview.setOnMouseClicked(newEventHandler<MouseEvent>(){ publicvoid handle(MouseEvent me){ primary

我是Javafx新手,我正在从事Javafx项目。我想最小化javafx窗口。
我使用primaryStage.initStyle(StageStyle.UNDECORATED)。我还想将clickevent添加到fxml中的imageview中。

我认为这对您很有用

imgview.setOnMouseClicked(newEventHandler<MouseEvent>(){
    publicvoid handle(MouseEvent me){
        primaryStage.setIconified(true);
    }
});
imgview.setOnMouseClicked(newEventHandler()){
publicvoid手柄(MouseeEvent me){
初级阶段。设置图标化(真);
}
});