Component[] items = 父控件.getComponents(); 获取父控件里的控件,返回Component类的数组。如panel中的许多button
e.getSource() 获取发生Event的对象。
//强制转换为抽象按钮:AbstractButton是JButton、JCheckBox、JRadioButton的父类
//由于不知道谁会被选中,所以使用它们的父类
AbstractButton btn=(AbstractButton)e.getSource();//发生Event的源头
05-11 11:23