Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Builds JavaFX forms with validation feedback, suggestion inputs, and preferences screens that persist settings.
Use this skill ↓91% 86%−5 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 20 of 22 without it.
3 of 3 safety checks passed
Use this skill when the application needs structured data entry, validation feedback, settings screens, or preference persistence. This is the focused slice left after splitting broader ecosystem-oriented concerns into their own skills.
import java.util.prefs.Preferences;
import javafx.beans.binding.Bindings;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
public class SettingsForm extends VBox {
private final Preferences preferences = Preferences.userNodeForPackage(SettingsForm.class);
public SettingsForm() {
var endpointField = new TextField(preferences.get("endpoint", ""));
var errorLabel = new Label();
var saveButton = new Button("Save");
errorLabel.textProperty().bind(
Bindings.when(endpointField.textProperty().isEmpty())
.then("Endpoint is required")
.otherwise("")
);
saveButton.disableProperty().bind(endpointField.textProperty().isEmpty());
saveButton.setOnAction(event -> preferences.put("endpoint", endpointField.getText()));
getChildren().addAll(new Label("API Endpoint"), endpointField, errorLabel, saveButton);
}
}
Next to this one in the catalogue, plus more from the same author.