Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package HelloWorld;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.StackPane;
- import javafx.stage.Stage;
- public class HelloWorld extends Application {
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) {
- primaryStage.setTitle("Tit's or GTFO!");
- final Button btn = new Button();
- btn.setText("Yes");
- btn.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- btn.setText("Link please!");
- }
- });
- final Button nobtn = new Button();
- nobtn.setText("No");
- nobtn.setOnAction(new EventHandler<ActionEvent>() {
- public void handle(ActionEvent event) {
- nobtn.setText("GTFO!");
- }
- });
- StackPane root = new StackPane();
- root.getChildren().add(btn);
- primaryStage.setScene(new Scene(root, 300, 250));
- primaryStage.show();
- StackPane stack = new StackPane();
- stack.getChildren().add(nobtn);
- primaryStage.setScene(new Scene(stack, 400, 350));
- primaryStage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement