Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package HelloWorld;
- import javafx.geometry.Pos;
- 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 {
- static Button btn = new Button("Yes!");
- static Button nobtn = new Button("No!");
- public static void main(String[] args) {
- launch(args);
- }
- @Override
- public void start(Stage primaryStage) {
- primaryStage.setTitle("Tit's or GTFO!");
- btn.setAlignment(Pos.CENTER_LEFT);
- btn.setText("Yes");
- primaryStage.show();
- btn.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- btn.setText("Link please!");
- }
- });
- nobtn.setAlignment(Pos.CENTER_RIGHT);
- nobtn.setText("No");
- primaryStage.show();
- nobtn.setOnAction(new EventHandler<ActionEvent>() {
- @Override
- public void handle(ActionEvent event) {
- nobtn.setText("GTFO!");
- }
- });
- StackPane root = new StackPane();
- root.getChildren().add(btn);
- root.getChildren().add(nobtn);
- primaryStage.setScene(new Scene(root, 300, 250));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement