Newer
Older
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TextArea;
@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
public void handleHurlSelected() {
int index = listView.getSelectionModel().getSelectedIndex();
listView.getItems().remove(index);
}