/************************************************************************/
// JavaFX CPT236 Encryption Application
// Rebecca Clark
// July 14, 2015
/************************************************************************/

import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;


public class CPT236EncryptionApplicationWithFunctionLambda extends Application {
   @Override // override start method in application class
   public void start(Stage primaryStage){
      //create a  grid pane 
      GridPane pane = new GridPane();
      pane.setPadding(new Insets(10, 10, 10, 10));
      pane.setVgap(5);
      
      //create a  flow pane 
      FlowPane fPane = new FlowPane();
      fPane.setAlignment(Pos.CENTER);
      fPane.setPadding(new Insets(10, 10, 10, 10));
      fPane.setHgap(5);
            
      //create buttons
      Button btnEncrypt = new Button("Encrypt");   
      Button btnClear = new Button("Clear");      
      Button btnDecrypt = new Button("Decrypt");
      
      //Create and register handlers
            
      btnEncrypt.setOnAction((e) -> {
         System.out.println("Process Encrypt");
      });
      
      btnClear.setOnAction((e) -> {
         System.out.println("Process Clear");
      });
      
      btnDecrypt.setOnAction((e) -> {
         System.out.println("Process Decrypt");
      });
      
            
      fPane.getChildren().addAll(btnEncrypt, btnClear, btnDecrypt);
      
      //place nodes in grid pane
      pane.add(new Label("Input Text:"), 0,0);
      pane.add(new TextArea(), 0, 1);
      pane.add(new Label("Output Text:"), 0,3);
      pane.add(new TextArea(), 0, 4);
      pane.add(fPane, 0, 2);
                            
      // create a scene and place it on the stage
      Scene scene = new Scene(pane, 300, 250);
      primaryStage.setTitle("CPT 236 Encryption Application");
      primaryStage.setScene(scene);
      primaryStage.show();      
   }
   
   public static void main(String[] args) {
      Application.launch(args);
   }
}
