question: private void loadLabelText ( JLabel component , String text ) { StringBuffer result = new StringBuffer ( ) ; boolean haveMnemonic = false ; char mnemonic = '\0' ; int mnemonicIndex = - 1 ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { if ( text . charAt ( i ) == '&' ) { i ++ ; if ( i == text . length ( ) ) { break ; } if ( ! haveMnemonic && text . charAt ( i ) != '&' ) { haveMnemonic = true ; mnemonic = text . charAt ( i ) ; mnemonicIndex = result . length ( ) ; } } result . append ( text . charAt ( i ) ) ; } component . setText ( result . toString ( ) ) ; if ( haveMnemonic ) { component . setDisplayedMnemonic ( mnemonic ) ; component . setDisplayedMnemonicIndex ( mnemonicIndex ) ; } }
target:  Initially generated by IntelliJ from a .form file, then checked in. 