#63 setRequiresSelection
authorKevin Lamonte <kevin.lamonte@gmail.com>
Thu, 31 Oct 2019 00:09:50 +0000 (19:09 -0500)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Thu, 31 Oct 2019 00:09:50 +0000 (19:09 -0500)
src/jexer/TRadioGroup.java
src/jexer/demos/DemoCheckBoxWindow.java

index 7f8c99c404e31c410aa6b4ad1a0f7dda17606c20..bfea5d6122356f171fb3cf30649bae93170c6729 100644 (file)
@@ -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);
             }
         }
index 961138d5c605c91b8d2cbce21c271ab9269f236a..faf3530cd47e86da9fac5103aac5e7dd6303dcba 100644 (file)
@@ -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<String> comboValues = new ArrayList<String>();
         comboValues.add(i18n.getString("comboBoxString0"));