public void enableCheckboxes(){
Component [] c = gui.panel.getComponents();
for (Component c1 : c) {
if (c1 instanceof JCheckBox) {
c1.setEnabled(true);
}
}
}
I'd wondered when I'd use the instanceof
operator. I kept seeing it lots of places. And I was unaware of the power of getComponents()
. Makes me want to tackle Reflection
soon.
Thanks to Niemeyer's Learning Java, chapter 17--Using Swing Components.
If there's another way--and surely there is--I hope to see it soon.