0
Button java
How do you create an interactive button that moves you from one screen to another?
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);
+ 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?
0
Hello Cole
Can you show us your attempt?
0
im asking for a future project
0
Maybe you can try with Swing.
Using JButton
0
i an familiar with JavaFX
0
i cannont create a window with a button