Skip to content
Snippets Groups Projects
Commit 4a34a247 authored by Andrea Magnussen's avatar Andrea Magnussen
Browse files

Merge branch '4-add-button-listener-for-submit'

parents f938db49 4f7f990f
No related branches found
No related tags found
1 merge request!7Draft: Resolve "add button listener for submit"
No preview for this file type
No preview for this file type
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?> <?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> <children>
<Button layoutX="100.0" layoutY="423.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="129.0" text="Submit thought" /> <Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" onAction="#handleSubmit" 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..." /> <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" /> <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"> <ScrollPane layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
<content> <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> </content>
</ScrollPane> </ScrollPane>
</children> </children>
......
package sample; package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
public class Controller { 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");
}
} }
...@@ -14,6 +14,8 @@ public class Main extends Application { ...@@ -14,6 +14,8 @@ public class Main extends Application {
primaryStage.setTitle("Hurl your thoughts"); primaryStage.setTitle("Hurl your thoughts");
primaryStage.setScene(new Scene(root, 700, 498)); primaryStage.setScene(new Scene(root, 700, 498));
primaryStage.show(); primaryStage.show();
} }
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
<?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?> <?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> <children>
<Button id="submitButton" layoutX="100.0" layoutY="423.0" mnemonicParsing="false" prefHeight="35.0" prefWidth="129.0" text="Submit thought" /> <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" layoutX="59.0" layoutY="299.0" prefHeight="106.0" prefWidth="307.0" promptText="Write your thought here..." /> <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" /> <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"> <ScrollPane layoutX="1.0" layoutY="40.0" prefHeight="258.0" prefWidth="700.0">
<content> <content>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment