Merge pull request #8 from AmnonOwed/FixRadioButton.removeItem

Fix RadioButton.removeItem(String)
This commit is contained in:
andreas schlegel 2015-07-30 10:34:19 +08:00
commit 096c553452

View File

@ -138,13 +138,15 @@ public class RadioButton extends ControlGroup< RadioButton > {
*/ */
public RadioButton removeItem( final String theName ) { public RadioButton removeItem( final String theName ) {
int n = _myRadioToggles.size( ); 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 ) ) { if ( ( _myRadioToggles.get( i ) ).getName( ).equals( theName ) ) {
( _myRadioToggles.get( i ) ).removeListener( this ); ( _myRadioToggles.get( i ) ).removeListener( this );
_myRadioToggles.get( i ).remove();
_myRadioToggles.remove( i ); _myRadioToggles.remove( i );
} }
} }
updateValues( false ); updateValues( false );
updateLayout( );
return this; return this;
} }