From 1605d4d282f46952178cfbb1e9c61bc248fc1d9e Mon Sep 17 00:00:00 2001 From: Katrina Eaton Date: Sun, 22 Nov 2020 16:27:13 -0800 Subject: [PATCH 1/2] working but needing a way to detarget words --- src/main/java/edu/mills/cs180a/wordui/FXMLController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/mills/cs180a/wordui/FXMLController.java b/src/main/java/edu/mills/cs180a/wordui/FXMLController.java index 849b53c..a1785ba 100644 --- a/src/main/java/edu/mills/cs180a/wordui/FXMLController.java +++ b/src/main/java/edu/mills/cs180a/wordui/FXMLController.java @@ -125,9 +125,13 @@ private void configureButtons() { .or(freqValidProperty.not()) .or(wordTextField.textProperty().isEmpty()) .or(definitionTextArea.textProperty().isEmpty())); - // TODO: Disable the Create button if an existing entry is selected or any // field is empty or invalid. + createButton.disableProperty() + .bind(listView.getSelectionModel().selectedItemProperty().isNotNull() + .or(wordTextField.textProperty().isEmpty()) + .or(freqValidProperty.not()) + .or(definitionTextArea.textProperty().isEmpty())); } // A frequency is valid if it is an integer and is at least 0. From d284b17aee9ac5804b0d30007e08ec2d3ba30d7d Mon Sep 17 00:00:00 2001 From: Katrina Eaton Date: Sun, 22 Nov 2020 17:13:57 -0800 Subject: [PATCH 2/2] button disable function working --- src/main/java/edu/mills/cs180a/wordui/FXMLController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/edu/mills/cs180a/wordui/FXMLController.java b/src/main/java/edu/mills/cs180a/wordui/FXMLController.java index a1785ba..1ba4739 100644 --- a/src/main/java/edu/mills/cs180a/wordui/FXMLController.java +++ b/src/main/java/edu/mills/cs180a/wordui/FXMLController.java @@ -125,7 +125,7 @@ private void configureButtons() { .or(freqValidProperty.not()) .or(wordTextField.textProperty().isEmpty()) .or(definitionTextArea.textProperty().isEmpty())); - // TODO: Disable the Create button if an existing entry is selected or any + // Disable the Create button if an existing entry is selected or any // field is empty or invalid. createButton.disableProperty() .bind(listView.getSelectionModel().selectedItemProperty().isNotNull()