From: Kevin Lamonte Date: Thu, 31 Oct 2019 00:09:50 +0000 (-0500) Subject: #63 setRequiresSelection X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=04050859e05bb4113349bcfaab4840a8c88d2aa5;p=nikiroo-utils.git #63 setRequiresSelection --- diff --git a/src/jexer/TRadioGroup.java b/src/jexer/TRadioGroup.java index 7f8c99c..bfea5d6 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 961138d..faf3530 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"));