From 73faed8e7e9e8e09b7ba69adfc0984441e5f1d97 Mon Sep 17 00:00:00 2001 From: GoToLoop Date: Sun, 17 Jul 2016 11:15:56 -0300 Subject: [PATCH] Update CheckBox.java public Toggle getItem( final String theName ) --- src/controlP5/CheckBox.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/controlP5/CheckBox.java b/src/controlP5/CheckBox.java index 3923e27..7d48ece 100755 --- a/src/controlP5/CheckBox.java +++ b/src/controlP5/CheckBox.java @@ -346,6 +346,20 @@ public class CheckBox extends ControlGroup< CheckBox > { return _myRadioToggles.get( theIndex ); } + /** + * Gets a radio button item by name. Null if not found! + * + * @param theName + * @return Toggle + */ + public Toggle getItem( final String theName ) { + if ( theName != null && !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { + for ( final Toggle tog : _myRadioToggles ) + if ( theName.equals( tog.getName( ) ) ) return tog; + } + return null; + } + public List< Toggle > getItems( ) { return _myRadioToggles; }