From c3bdd53a3cf39bf3d948f3bc551ff3d80b97200a Mon Sep 17 00:00:00 2001 From: AmnonOwed Date: Tue, 5 May 2015 09:13:10 +0200 Subject: [PATCH] Fix RadioButton.removeItem(String) --- src/controlP5/RadioButton.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controlP5/RadioButton.java b/src/controlP5/RadioButton.java index 0f40a33..6857b65 100755 --- a/src/controlP5/RadioButton.java +++ b/src/controlP5/RadioButton.java @@ -138,13 +138,15 @@ public class RadioButton extends ControlGroup< RadioButton > { */ public RadioButton removeItem( final String theName ) { int n = _myRadioToggles.size( ); - for ( int i = 0 ; i < n ; i++ ) { + for ( int i = n-1 ; i >= 0 ; i-- ) { if ( ( _myRadioToggles.get( i ) ).getName( ).equals( theName ) ) { ( _myRadioToggles.get( i ) ).removeListener( this ); + _myRadioToggles.get( i ).remove(); _myRadioToggles.remove( i ); } } updateValues( false ); + updateLayout( ); return this; }