package class3_3_JavaFX; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.effect.BoxBlur; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class Main extends Application { private Label label; @Override public void start(Stage primaryStage) throws Exception{ Pane root = new StackPane(); label = new Label("This is a lot of text that will show up on the screen!"); Button clickMe = new Button("Click Me!"); clickMe.setOnAction(new MyHandler()); root.getChildren().addAll(label, clickMe); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(root, 300, 50)); primaryStage.show(); } public static void main(String[] args) { launch(args); } public class MyHandler implements EventHandler { public void handle(ActionEvent e) { System.out.println("The button was pressed!"); System.out.println(label.getText()); if(label.getEffect() == null) { label.setEffect(new BoxBlur()); } else { label.setEffect(null); } } } }