Skip to content
Snippets Groups Projects
Commit 0bc171dd authored by Herman Andersen Dyrkorn's avatar Herman Andersen Dyrkorn
Browse files

select thoughts

parent ac7cbeae
No related branches found
No related tags found
1 merge request!24Resolve "hurl selected thoughts"
package sample;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
......@@ -25,11 +26,15 @@ public class Controller {
//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);
}
}
......@@ -31,5 +31,6 @@
</content>
</ScrollPane>
<Button layoutX="531.0" layoutY="10.0" mnemonicParsing="false" onAction="#handleHurlAll" text="Hurl all your thoughts" />
<Button layoutX="365.0" layoutY="10.0" mnemonicParsing="false" onAction="#handleHurlSelected" text="Hurl selected thoughts" />
</children>
</AnchorPane>
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