0

Button java

How do you create an interactive button that moves you from one screen to another?

7th Mar 2020, 6:44 PM
Cole
7 odpowiedzi
+ 2
Cole JavaFX is fine :) import javafx.scene.control.Button; window: Stage primaryStage scene: Scene one, Scene two button: btn Button btn = new Button("go to next scene"); btn.setOnAction(e -> { primaryStage.setScene(two); } For adding the button you can use any layout: StackPane layout = new StackPane(300,300); layout.getChildren().add(btn);
7th Mar 2020, 7:14 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Cole And I don't want to just write you a code, but see if you've tried something before. Do you know about GUI (Swing or JavaFX)? Can you create a window with a button? Are you familiar with event handling?
7th Mar 2020, 6:56 PM
Denise Roßberg
Denise Roßberg - avatar
0
Hello Cole Can you show us your attempt?
7th Mar 2020, 6:50 PM
Denise Roßberg
Denise Roßberg - avatar
0
im asking for a future project
7th Mar 2020, 6:50 PM
Cole
0
Maybe you can try with Swing. Using JButton
7th Mar 2020, 6:57 PM
Nebojsa Barac
Nebojsa Barac - avatar
0
i an familiar with JavaFX
7th Mar 2020, 6:59 PM
Cole
0
i cannont create a window with a button
7th Mar 2020, 6:59 PM
Cole