/home/caleb/ASDV-Java/Semester 3/Assignments/lab2_FX2_F22_part1/src/lab2_fx2_f22_part1/HandleClickEventAnonymous.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package lab2_fx2_f22_part1;
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.Pane;
import javafx.stage.Stage;
import style.ButtonStyle;
public class HandleClickEventAnonymous extends Application
{
@Override
public void start(Stage primaryStage) throws Exception
{
Button button = new Button("OK");
button.setStyle(ButtonStyle.getStyle());
EventHandler eventHnadler = new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent t)
{
System.out.println("You clicked OK!");
}
};
button.setOnAction(eventHnadler);
Pane pane = new Pane();
pane.getChildren().add(button);
Scene scene = new Scene( pane);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args)
{
launch( args);
}
}