/home/caleb/ASDV-Java/Semester 3/Assignments/lab2_FX2_F22_part1/src/lab2_fx2_f22_part1/HandleClickEvent.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
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.BorderPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import style.ButtonStyle;

/**
 *
 * @author Athanasios V. Markou
 */
public class HandleClickEvent extends Application
{

    @Override
    public void start(Stage primaryStage) throws Exception
    {
        Button buttonOK = new Button("OK");
        buttonOK.setStyle(ButtonStyle.getStyle());
        OKHandlerClass eventHnadlerOK = new OKHandlerClass();
        buttonOK.setOnAction(eventHnadlerOK);
        
        Button buttonCancel = new Button("Cancel");
        buttonCancel.setStyle(ButtonStyle.getStyle());
        CancelHandlerClass eventHandlerCancel = new CancelHandlerClass();
        buttonCancel.setOnAction(eventHandlerCancel);
        
        
        BorderPane pane = new BorderPane();
        pane.setTop(buttonOK);
        pane.setBottom(buttonCancel);
        Scene scene = new Scene( pane);
        primaryStage.setScene(scene);
        primaryStage.show();
        
    }
    public static void main(String[] args)
    {
        launch( args);
    }

    private static class OKHandlerClass implements EventHandler<ActionEvent> {
        
        @Override
        public void handle(ActionEvent event) {
            System.out.println("You clicked OK!");
        }
    }
 
     private static class CancelHandlerClass implements EventHandler<ActionEvent> {
        
        @Override
        public void handle(ActionEvent event) {
            System.out.println("You clicked Cancel!");
        }
    }
}