当我试图将标签从第一屏幕传递到第二屏幕时,我得到一个白色屏幕?

时间:2015-07-06 20:48:40

标签: javafx

当我尝试从第一个屏幕舞台传递标签到第二个屏幕时,我遇到了严重的问题。重要的工作人员是,如果在我的代码中我选择打开那个阶段而不是在第二个屏幕,但在拳头中的东西工作,但如果放到第二个屏幕我得到一个白色阶段,我不知道我做错了,请帮助我!

  public void FullScreen() throws IOException {
        List<Screen> allScreens = Screen.getScreens();
        //if (allScreens.size() > 1) {
        Screen secondaryScreen = allScreens.get(1); // if i change this to 0 it works but i get the stage in the first Screen.
        Rectangle2D bounds = secondaryScreen.getVisualBounds();
        b.setEy(FXMLLoader.load(getClass().getResource("DoileaMonitor.fxml")));
        ThingUp.root.getChildren().remove(getLblStrofe());// main stage
        getLblStrofe().setLayoutX(bounds.getMinX());
        getLblStrofe().setLayoutY(bounds.getMinY());
        getLblStrofe().setPrefSize(bounds.getWidth(), bounds.getHeight());
        b.getEy().getChildren().add(getLblStrofe());//second stage
        Scene scene = new Scene(b.getEy());

        Stage stage = new Stage();
        stage.setScene(scene);
        stage.setX(bounds.getMinX());
        stage.setY(bounds.getMinY());
        stage.setWidth(bounds.getWidth());
        stage.setHeight(bounds.getHeight());
        stage.initStyle(StageStyle.UNDECORATED);
//      stage.initModality(Modality.APPLICATION_MODAL);
        stage.show();
        // }
    }

0 个答案:

没有答案