저는 독자적으로 JavaFx를 배우고 있으며 아직 FXML에 도달하지 않았습니다. 사용자가 두 번째 장면에서 자격 증명을 입력 한 후 응용 프로그램의 기본 장면으로 돌아갈 계획 인 한 응용 프로그램에 갇혀 있습니다. 나는 메인에서 두 번째 장면을 가져올 수 있었지만 두 번째 장면에서 메인 장면으로 갈 수 없었다. 나는 getter를 사용하여 메인 장면과 창을 얻으려고했지만 행운이 없었다. 너희들이 올바른 방법으로 가르 칠 수 있니?JavaFX : FXML없이 기본 페이지로 돌아 가기
미리 감사드립니다.
public class Landing extends Application {
BorderPane bp;
Scene scene;
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Welcome to our Telco!");
bp = new BorderPane();
VBox vbox = new VBox();
Button login = new Button("Login");
login.setMinWidth(100);
Button acc = new Button("Account Information");
acc.setMinWidth(100);
vbox.getChildren().addAll(acc);
bp.setCenter(vbox);
acc.setOnAction(e ->{
AccountInfo account = new AccountInfo();
primaryStage.setTitle("Account Information"); // Set the stage title
primaryStage.getScene().setRoot(account.getbp());; // Place the scene in the stage
});
scene = new Scene(bp, 750, 550);
primaryStage.setScene(scene);
primaryStage.show();
}
public Pane getbp() {
return bp;
}
public Scene getSc(){
return scene;
}
버튼
는public class AccountInfo {
BorderPane pane;
Landing main = new Landing();
Scene scene;
AccountInfo() {
Button c = (new Button("Back"));
c.setStyle("-fx-background-color: pink");
c.setOnAction((ActionEvent e) -> {
main.getbp();
main.getSc();
});
public Pane getbp() {
return pane;
}
}
당신이 자격 증명을 입력 할 수있는 간단한 대화 상자입니다 필요 할 수 있습니다, 당신이 그 대화 이후 – Oswald
감사합니다 당신을 다시 @Oswald을 닫을 수 있습니다. 나는 그 가능성을 더 깊이 탐구 할 것이다. – Ddz