Last active
August 29, 2015 14:27
-
-
Save tferr/500b9a9216a0f07d5194 to your computer and use it in GitHub Desktop.
Get checkbox of RadioButtonGroup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieves the Checkbox of a RadioButtonGroup() in an ImageJ1 | |
* GenericDialog associated with the specified label. | |
*/ | |
Checkbox getRadioCheckbox(ij.gui.GenericDialog gd, String label) { | |
Component[] gdComponents = gd.getComponents(); | |
for (Component c1 : gdComponents) { | |
if (c1 instanceof Panel) { | |
Component[] c1Components = ((Panel) c1).getComponents(); | |
for (Component c2 : c1Components) { | |
if (c2 instanceof Checkbox) { | |
Checkbox cb = (Checkbox)c2; | |
if (cb.getLabel().equals(label)) | |
return cb; | |
} | |
} | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment