From 4f7f990f9dcdc6b47b686ddf1c9e5d9f2bc87a1e Mon Sep 17 00:00:00 2001
From: Andrea Magnussen <andmag@stud.ntnu.no>
Date: Sat, 29 Aug 2020 13:22:45 +0200
Subject: [PATCH] added a listener for the submit button

---
 .../hurlers/sample/Controller.class           | Bin 269 -> 788 bytes
 out/production/hurlers/sample/Main.class      | Bin 1200 -> 1207 bytes
 out/production/hurlers/sample/sample.fxml     |   8 +++---
 src/sample/Controller.java                    |  24 ++++++++++++++++++
 src/sample/Main.java                          |   2 ++
 src/sample/sample.fxml                        |   6 ++---
 6 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/out/production/hurlers/sample/Controller.class b/out/production/hurlers/sample/Controller.class
index 1a0efd475a3846ad55573e2c70260ef39678d3f4..4dc8c622e986e953a9242896baff54510f369fb5 100644
GIT binary patch
literal 788
zcmaJ<T~8B16g^YgZo6IS7gPZeP|&t0^WvMvgplyGsIjE+%}mQshV0HZyR)YLER8|q
zgD<}Mql|ZUOQ<37Wp3`BbIv_;=l=fl<0pXU;4Z3IuVMrDE7)}L09zGoS5d)^i-&mR
zVAsJOL&eCMIgF)X*zzyMM{z#m$yjR1$B{O16!6nI;043lyHpz$%ArcsD3FI*M@ASG
z>4c$m%|4%n0Y83!;uE3#QfXygF)Vd^Lx$o}bS4?<zS8n_8jfUqDoDqYqp=8vB33q^
z7mMaXk#O5jL^us3KgtaSGA3p3Lg=$V4$@Jm4C$M2dhLM+LQnX>#7a*H=?<ba9?N58
z8`W<_4(w|^ETit=v4<z<GSp5)7>e!W*LSTQ^gQ&j&j1fDY7U-yc!mRp<}E`E4Xc)S
zelxn1WAe068hlEO49RAc(#2{vDy|~_mOL7ADn&?6+nL6{Wd>(zL4hV-HzzK>&yIET
zzyC%G6KU)(GOToaw<WMcTT!L0VJO&#QuHV*Q@lg5K#_(-XM-|MktTvt{~Orn?7B&(
z1p^LRbb2`eZLDPXt3)nj<PQ`JRNMH1LTl*?#a7Ahe?|EUj!&h1s@zC+P$K9ud25iT
fCdsw2PWx<IbaI(_iy9$1xJzvpeKXw4+OPcuN6)Ol

delta 108
zcmbQj*2^S%>ff$?3=9k=3<6vX%nZEj41DYi{1ba)CJQslGqW(TPEKZ27h_OlU;@g5
s03#3rg@Gj7<TxfVb#|Z_8<58Ul;;4FJYY5}11AF)ST#40WMbd}08)brNB{r;

diff --git a/out/production/hurlers/sample/Main.class b/out/production/hurlers/sample/Main.class
index e1118a1cb68ba5b595b5b6770f447ba3e97245b5..967acb36f53db4d39038f97651fb26fd4e9266a4 100644
GIT binary patch
delta 87
zcmdnMxt()@A$RKo1`uF#s8`r%)66I=<WX9bqfnV&TBJ~tkzbmgQBu75G-D<cqwr)?
jmMBGW1{MYhAY@?RVPFK3tPH9QYCxKiK^;gkF=zk)@?#N&

delta 56
zcmdnaxq)+nA$QRM1`uF#C^Xn;)6B@j?U9<3ldlk-UzC%w`4VF$6Qkf{8<r?mQ3e(U
JvB|SpWB|L>4z&OP

diff --git a/out/production/hurlers/sample/sample.fxml b/out/production/hurlers/sample/sample.fxml
index 3ff8d29..98a7c2e 100644
--- a/out/production/hurlers/sample/sample.fxml
+++ b/out/production/hurlers/sample/sample.fxml
@@ -6,14 +6,14 @@
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.text.Text?>
 
-<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="498.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
+<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="498.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="sample.Controller" xmlns:fx="http://javafx.com/fxml/1">
    <children>
-      <Button layoutX="100.0" layoutY="423.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
-      <TextArea layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
+      <Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" onAction="#handleSubmit" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
+      <TextArea id="textBox" fx:id="textArea" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
       <Text layoutX="65.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your thoughts" />
       <ScrollPane layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
          <content>
-            <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Text" wrappingWidth="33.22460746765137" />
+            <Text id="thoughtId" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" wrappingWidth="33.22460746765137" />
          </content>
       </ScrollPane>
    </children>
diff --git a/src/sample/Controller.java b/src/sample/Controller.java
index 54e5bd1..85c8337 100644
--- a/src/sample/Controller.java
+++ b/src/sample/Controller.java
@@ -1,4 +1,28 @@
 package sample;
 
+import javafx.event.ActionEvent;
+import javafx.fxml.FXML;
+import javafx.scene.control.TextArea;
+
 public class Controller {
+
+    @FXML
+    private TextArea textArea;
+
+    @FXML
+    private void handleSubmit() {
+        System.out.println("Mamma sønn");
+
+        String tmp = "";
+        tmp = textArea.getText();
+
+        System.out.println(tmp);
+
+        //Thought tmpThought = new Thought();
+
+
+
+        // Button was clicked, do something...
+        //outputTextArea.appendText("Button Action\n");
+    }
 }
diff --git a/src/sample/Main.java b/src/sample/Main.java
index 39e0c18..81ca8bb 100644
--- a/src/sample/Main.java
+++ b/src/sample/Main.java
@@ -14,6 +14,8 @@ public class Main extends Application {
         primaryStage.setTitle("Hurl your thoughts");
         primaryStage.setScene(new Scene(root, 700, 498));
         primaryStage.show();
+
+
     }
 
 
diff --git a/src/sample/sample.fxml b/src/sample/sample.fxml
index d7677ae..98a7c2e 100644
--- a/src/sample/sample.fxml
+++ b/src/sample/sample.fxml
@@ -6,10 +6,10 @@
 <?import javafx.scene.layout.AnchorPane?>
 <?import javafx.scene.text.Text?>
 
-<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="498.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
+<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="498.0" prefWidth="700.0" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="sample.Controller" xmlns:fx="http://javafx.com/fxml/1">
    <children>
-      <Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
-      <TextArea id="textBox" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
+      <Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" onAction="#handleSubmit" prefHeight="35.0" prefWidth="129.0" text="Submit thought" />
+      <TextArea id="textBox" fx:id="textArea" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." />
       <Text layoutX="65.0" layoutY="31.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Your thoughts" />
       <ScrollPane layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
          <content>
-- 
GitLab