Last active
October 11, 2015 13:58
-
-
Save TheItachiUchiha/5209f82b6d9f31c97b57 to your computer and use it in GitHub Desktop.
Clickable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.geometry.Pos; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.VBox; | |
import javafx.stage.Stage; | |
public class Main extends Application { | |
@Override | |
public void start(Stage primaryStage) throws Exception { | |
Button button1 = new Button("Hey"); | |
VBox box = new VBox(10, button1); | |
button1.setOnAction(event -> { | |
Button btn = new Button(); | |
btn.setText("Say 'Hello World'"); | |
btn.setOnAction(event1 -> System.out.println("Hello World!")); | |
box.getChildren().add(btn); | |
}); | |
box.setAlignment(Pos.CENTER); | |
Scene scene = new Scene(box, 200, 200); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment