在JavaFx中更改窗格
我一直试图通过如下所示将可视性状态设置为true或false来交换窗格,但noyhing到目前为止还在工作 我迄今为止失败的方法:在JavaFx中更改窗格,java,javafx,Java,Javafx,我一直试图通过如下所示将可视性状态设置为true或false来交换窗格,但noyhing到目前为止还在工作 我迄今为止失败的方法: 该程序在homeContentDisplay的可见性设置为true时启动。当page2ContentDisplay的可见性更改为true时,单击按钮将其设置为false 代码: @FXML private Pane homeContentDisplay; private Pane page2ContentDisplay; @FXML private void ha
该程序在homeContentDisplay的可见性设置为true时启动。当page2ContentDisplay的可见性更改为true时,单击按钮将其设置为false 代码:
@FXML
private Pane homeContentDisplay;
private Pane page2ContentDisplay;
@FXML
private void handleButtonActionShow(MouseEvent event) {
homeContentDisplay.setVisible(false);
page2ContentDisplay.setVisible(true);
FadeTransition fadeIn = new FadeTransition(
Duration.millis(3000), homeContentDisplay
);
fadeIn.setFromValue(0.0);
fadeIn.setToValue(1.0);
fadeIn.setCycleCount(1);
fadeIn.setAutoReverse(false);
fadeIn.play();
}
还请包括您的fxml文件。为什么
page2ContentDisplay
没有用@fxml
注释?感谢各位的回复,你是对的。这是@FXML。希望我能投你一票,但我不能;我的分数不够高。不客气,伙计:)有没有更好的办法?我不喜欢通过设置可见性(true/false)来工作。这是我先前的问题: