package org.jdcoffre.mlc.desktop.cellar;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.layout.GridPane;
import org.jdcoffre.mlc.desktop.Controller;
import org.jdcoffre.mlc.lib.MLCExecption;

public class CellarPane extends GridPane implements EventHandler<ActionEvent> {

    private final Controller controller;

    public CellarPane(final Controller controller){
        super();

        this.controller = controller;

        setAlignment(Pos.CENTER);
        setHgap(10);
        setVgap(10);
        setPadding(new Insets(25, 25, 25, 25));

        add(new ErrorMessageArea(), 0,0, 2, 1);

        add(new CellarLabel(), 0,1);
        add(new CellarField(), 1, 1);
        add(new AddCellarButton(this), 2, 1);
    }

    @Override
    public void handle(ActionEvent event) {
        try {
            CellarField cellarField = (CellarField) lookup("#" + CellarField.ID);
            controller.addCellar(cellarField.getText());
        } catch (MLCExecption mlcExecption) {
            ErrorMessageArea errorMessage = (ErrorMessageArea) lookup("#" + ErrorMessageArea.ID);
            errorMessage.setText(mlcExecption.getMessage());
        }
    }
}

@@ -532,39 +532,97 @@
  set
-Alignment(Pos.CENTER
+Padding(new Insets(10, 10, 10, 10));%0A        add(new ErrorMessageArea(), 0, 0
 );%0A
+%0A
         
 setH
@@ -617,16 +617,74 @@
         
+GridPane fieldsArea  = new GridPane();%0A        fieldsArea.
 setHgap(
@@ -696,16 +696,27 @@
         
+fieldsArea.
 setVgap(
@@ -720,32 +720,43 @@
 ap(10);%0A        
+fieldsArea.
 setPadding(new I
@@ -765,35 +765,34 @@
 ets(
-25, 25, 25, 25
+10, 10, 10, 10
 ));%0A
-%0A
         
 add(
@@ -791,57 +791,19 @@
     
-add(new ErrorMessageArea(), 0,0, 2, 1);%0A%0A        
+fieldsArea.
 add(
@@ -823,17 +823,17 @@
 el(), 0,
-1
+0
 );%0A     
@@ -827,32 +827,43 @@
 , 0,0);%0A        
+fieldsArea.
 add(new CellarFi
@@ -872,17 +872,17 @@
 d(), 1, 
-1
+0
 );%0A     
@@ -875,32 +875,44 @@
 , 1, 0);%0A       
+ fieldsArea.
  add(new AddCell
@@ -929,16 +929,47 @@
 his), 2,
+ 0);%0A        add(fieldsArea, 0,
  1);%0A   
@@ -1026,24 +1026,152 @@
 nt event) %7B%0A
+        ErrorMessageArea errorMessage = (ErrorMessageArea) lookup(%22#%22 + ErrorMessageArea.ID);%0A        errorMessage.setText(%22%22);%0A
         try 
@@ -1361,106 +1361,8 @@
 ) %7B%0A
-            ErrorMessageArea errorMessage = (ErrorMessageArea) lookup(%22#%22 + ErrorMessageArea.ID);%0A
     

Make sure error message disappear on button click