Files
SE-1011/Fall 2017/SE 1011/Event Handling/src/sample/SimpleGUI.java
2019-08-13 12:17:37 -05:00

35 lines
1.0 KiB
Java

package sample;
import javafx.application.Application;
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 SimpleGUI extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
Pane root = new StackPane();
Label label = new Label("Here is some text that can be manipulated with the button above.");
Button clickMe = new Button("Click Me");
clickMe.setOnAction(event -> {
if(label.getEffect()==null) {
label.setEffect(new BoxBlur());
} else {
label.setEffect(null);
}
});
root.getChildren().addAll(label, clickMe);
primaryStage.setTitle("Simple GUI");
primaryStage.setScene(new Scene(root, 400, 300));
primaryStage.show();
}
}