From 04050859e05bb4113349bcfaab4840a8c88d2aa5 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Wed, 30 Oct 2019 19:09:50 -0500 Subject: [PATCH] #63 setRequiresSelection --- src/jexer/TRadioGroup.java | 2 +- src/jexer/demos/DemoCheckBoxWindow.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jexer/TRadioGroup.java b/src/jexer/TRadioGroup.java index 7f8c99c4..bfea5d61 100644 --- a/src/jexer/TRadioGroup.java +++ b/src/jexer/TRadioGroup.java @@ -239,7 +239,7 @@ public class TRadioGroup extends TWidget { public void setRequiresSelection(final boolean requiresSelection) { this.requiresSelection = requiresSelection; if (requiresSelection) { - if (getChildren().size() > 0) { + if ((getChildren().size() > 0) && (selectedButton == null)) { setSelected(1); } } diff --git a/src/jexer/demos/DemoCheckBoxWindow.java b/src/jexer/demos/DemoCheckBoxWindow.java index 961138d5..faf3530c 100644 --- a/src/jexer/demos/DemoCheckBoxWindow.java +++ b/src/jexer/demos/DemoCheckBoxWindow.java @@ -105,6 +105,7 @@ public class DemoCheckBoxWindow extends TWindow { group.addRadioButton(i18n.getString("radioOption1")); group.addRadioButton(i18n.getString("radioOption2"), true); group.addRadioButton(i18n.getString("radioOption3")); + group.setRequiresSelection(true); List comboValues = new ArrayList(); comboValues.add(i18n.getString("comboBoxString0")); -- 2.27.0