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 { @FXML private TextArea textArea; @FXML private ListView<String> listView; @FXML private void handleSubmit() { //create new thought, parameter from textArea Thought t = new Thought(textArea.getText()); //clear textArea textArea.clear(); //add the thoughts to the lists listView.getItems().addAll(t.getThought()); listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); } public void handleHurlAll() { //delete all thoughts and display the list listView.getItems().clear(); } public void handleHurlSelected() { int index = listView.getSelectionModel().getSelectedIndex(); listView.getItems().remove(index); } }