public static AbstractButton getAt ( ButtonGroup self , int index ) { int size = self . getButtonCount ( ) ; if ( index < 0 || index >= size ) return null ; Enumeration buttons = self . getElements ( ) ; for ( int i = 0 ; i <= index ; i ++ ) { AbstractButton b = ( AbstractButton ) buttons . nextElement ( ) ; if ( i == index ) return b ; } return null ; }
Support the subscript operator for ButtonGroup .