参考资料:xietansheng-JavaSwing图形界面开发
1. 概述
官方JavaDocsApi: javax.swing.JRadioButton
JRadioButton
,单选按钮。
JButton 常用构造方法:
JRadioButton 常用方法:
JRadioButton 常用监听器:
ButtonGroup(按钮组):
当有多个单选按钮时,一般只允许一个单选按钮选中,因此需要对同一类型的单选按钮进行分组,如下:
2. 代码实例
效果展示:
参考资料:xietansheng-JavaSwing图形界面开发
官方JavaDocsApi: javax.swing.JRadioButton
JRadioButton
,单选按钮。
JButton 常用构造方法:
JRadioButton 常用方法:
JRadioButton 常用监听器:
ButtonGroup(按钮组):
当有多个单选按钮时,一般只允许一个单选按钮选中,因此需要对同一类型的单选按钮进行分组,如下:
效果展示:
<RadioButton android:id="@+id/tank_warning_setting_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:la
更换单选按钮显示样式 我要保密 我是帅哥 我是美女 我要保密 我是帅哥 我是美女 更换单选按钮显示样式 我要保密 我是...
选择组件前面已经讲述了如何获取用户输入的文本。但是在很多情况下,可能更加愿意给用户几种选择而不是让用户在文本组件中输入数据。给一组按钮或者一列选项让用户做出选择。(这样也免去了检查错误的麻烦。)在本节中,将介绍如何编写程序实现复选框、单选按钮、选项列表以及滑块。复选框如果想要接收的输入只是“是”或“非”,就可以使用复选框组件。复选框自动地带有标识标签。用户通过点击某个复选框来选择相应的选项,再点击
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M