When you ask a button group for the currently selected radio button, it returns the selected radio button's model (rather than the selected radio button itself). Fortunately, the button group maintains the list of buttons and so you can iterate over this list looking for one with the same model.

    // This method returns the selected radio button in a button group
public static JRadioButton getSelection(ButtonGroup group) {
for (Enumeration e=group.getElements(); e.hasMoreElements(); ) {
JRadioButton b = (JRadioButton)e.nextElement();
if (b.getModel() == group.getSelection()) {
return b;
}
}
return null;
}
Related Examples

最新文章

  1. try catch中用了 Response.Redirect 引发的线程异常终止
  2. 2.线性表-Linked list
  3. store操作
  4. yii2安装
  5. 常用http请求状态码含义
  6. 完整实例(C# Socket)
  7. windows 7 中将“我的电脑”锁定到任务栏
  8. php中字符串编码
  9. lua select
  10. Node.js log2: ERR when execute command >npm install
  11. [ASP.NET]利用itextsharp将GridView汇出PDF档
  12. Python Redis 数据复制.
  13. 老李分享:Mac快捷键
  14. 逛csdn看见的一个知识阶梯,感觉不错
  15. java 学习笔记
  16. lwip TCP client & FreeRTOS 打开TCP 的 保活机制 LWIP_TCP_KEEPALIVE==1
  17. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.bw.mapper.BillMapper.getBillList at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225
  18. 利用iscroll实现上拉加载下拉刷新
  19. laravel5.8笔记二:部署
  20. Laravel 5.5 文档 ] 快速入门 —— 安装配置篇

热门文章

  1. pandas数组获取最大值索引的方法-argmax和idxmax
  2. [Windows Azure] Create and use a reporting service in Windows Azure SQL Reporting
  3. 转webstorm的快捷键
  4. lsblk命令
  5. 面试问卷-java&Oracle
  6. 微服务之springCloud-docker-feign-hystrix(六)
  7. python使用selenium
  8. git学习(七):git 对象库
  9. AJAX 简单例程示例
  10. [shell]shell 中| && || () {} 用法以及shell的逻辑与或非