File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/main/java/com/fulinlin/ui/commit Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1313
1414import javax .swing .*;
1515import java .awt .*;
16+ import java .util .Iterator ;
1617import java .util .List ;
1718import java .util .Objects ;
1819
@@ -152,11 +153,20 @@ private void settingHidden(CommitTemplate commitMessageTemplate) {
152153 changeType .addActionListener (e -> {
153154 if (changeType .getSelectedItem () != null ) {
154155 String typeTitle = ((TypeAlias ) Objects .requireNonNull (changeType .getSelectedItem ())).getTitle ();
155- buttonGroup .getElements ().asIterator ().forEachRemaining (radioButton -> {
156- if (radioButton .getActionCommand ().equals (typeTitle )) {
157- radioButton .setSelected (true );
156+ Iterator <AbstractButton > iterator = buttonGroup .getElements ().asIterator ();
157+ boolean flag = false ;
158+ while (iterator .hasNext ()) {
159+ AbstractButton radioButton = iterator .next ();
160+ boolean equals = radioButton .getActionCommand ().equals (typeTitle );
161+ radioButton .setSelected (equals );
162+ if (equals ) {
163+ flag = true ;
164+ break ;
158165 }
159- });
166+ }
167+ if (!flag ) {
168+ buttonGroup .clearSelection ();
169+ }
160170 }
161171 });
162172 for (TypeAlias type : typeAliases ) {
You can’t perform that action at this time.
0 commit comments