Skip to content

Commit

Permalink
Fix RadioButton.removeItem(String)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmnonOwed committed May 5, 2015
1 parent 8ade1d4 commit c3bdd53
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controlP5/RadioButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,15 @@ public RadioButton addItem( final Toggle theToggle , final float theValue ) {
*/
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;
}

Expand Down

0 comments on commit c3bdd53

Please sign in to comment.