javafx stagestyle UNDECORATED

时间:2018-05-24 23:58:22

标签: javafx javafx-8

我正在使用翻译。 enter image description here

单击图像时会出现意外的Windows桌面。 Scrollpane - > BorderPane 一般是正常的,就像以后的图像一样发生

        FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Main_fx.fxml"));
        Parent root = loader.load();

        st = new Stage();

        final UndecoratorScene undecorator = new UndecoratorScene(st, (Region) root);//NewMainScene lib 사용(프로젝트 및 패키지 명 :Newtable)
        undecorator.getStylesheets().add(getClass().getResource("/View/winDec.css").toExternalForm());

        st.setScene(undecorator);
        stage = (Stage) lb.getScene().getWindow();
        st.getIcons().add(new Image(config2.class.getResourceAsStream("/View/207411.jpg" )));
        st.initStyle(StageStyle.TRANSPARENT); //스타일 미적용.
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.sizeToScene();
      //  Undecorator undecor = undecorator.getUndecorator();

        //최소로 줄이수 있는 화면 크기 값 .
        st.setMinWidth(350);
        st.setMinHeight(200);

        GetStage gs = new GetStage();//트레이 창으로 보낼때 현재 Stage 값 전달.
        gs.SetStage(st);
        st.toFront();
        st.show();           

        Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();

        st.setX((primScreenBounds.getWidth() - st.getWidth()) / 2);
        st.setY((primScreenBounds.getHeight() - st.getHeight()) / 2);


        createTrayIcon(st);//트레이 창 이벤트 메소드

        firstTime = true;
        Platform.setImplicitExit(false);
        stage.close();//controllSplash stage 종료

        Hander_Main controller = (Hander_Main)loader.getController();

        SimpleDateFormat formatter  = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
        Date sys_date = new Date();
        String now= formatter.format(sys_date);

        controller.setPrimaryStage(st);
        controller.setScene(undecorator);
        controller.setFirstDate(now);

        st.setOnCloseRequest(new EventHandler<WindowEvent>() {
            public void handle(WindowEvent we) 
            {
                hide(st);
            }
        });
    } catch (Exception e) {
        st.hide();
        dialog(Alert.AlertType.ERROR,"Main_fx Stage ERR\n"+e);
        System.exit(0);
    }

0 个答案:

没有答案