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

Made the thoughts in a list instead

parent 534eef4c
No related branches found
No related tags found
1 merge request!19Resolve "appending textview to thoughts"
......@@ -2,6 +2,8 @@ package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TextArea;
public class Controller {
......@@ -9,6 +11,9 @@ public class Controller {
@FXML
private TextArea textArea;
@FXML
private ListView<String> listView;
@FXML
private void handleSubmit() {
......@@ -18,21 +23,14 @@ public class Controller {
//clear textArea
textArea.clear();
//get the thought manager and add the thought to the manager
ThoughtManager tm = ThoughtManager.getInstance();
tm.add(t);
tm.displayList();
//add the thoughts to the lists
listView.getItems().addAll(t.getThought());
listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
public void handleHurlAll() {
//get the thought manager
ThoughtManager tm = ThoughtManager.getInstance();
//delete all thoughts and display the list
tm.hurl();
tm.displayList();
listView.getItems().clear();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
......@@ -24,6 +25,7 @@
<Font size="14.0" />
</font>
</Text>
<ListView fx:id="listView" layoutX="37.0" layoutY="14.0" prefHeight="200.0" prefWidth="585.0" />
</children>
</AnchorPane>
</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