java swing单选按钮_JAVA Swing 获取单选按钮的值,复选框的值

这是一个Java Swing应用示例,演示如何在用户点击'提交'按钮时,从单选按钮(JRadioButton)和复选框(JCheckBox)中获取选中值。程序创建了一个窗口,包含性别选择的单选按钮和爱好选择的复选框,点击'提交'按钮后触发监听事件,获取并处理选定选项。
摘要由CSDN通过智能技术生成

这是我自己写的一个测试程序,要求在点击“提交”按钮时,在监听事件中获取单选按钮的值,和复选框的值packagehelloworld;importjava.awt.*;importjavax.swing.*;importcom.borland.j...

这是我自己写的一个测试程序,要求在点击“提交”按钮时,在监听事件中获取单选按钮的值,和复选框的值

package helloworld;

import java.awt.*;

import javax.swing.*;

import com.borland.jbcl.layout.XYLayout;

import com.borland.jbcl.layout.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

public class Frame1 extends JFrame {

XYLayout xYLayout1 = new XYLayout();

JLabel jLabel1 = new JLabel();

JRadioButton jRadioButton1 = new JRadioButton();

JRadioButton jRadioButton2 = new JRadioButton();

JButton jButton1 = new JButton();

JLabel jLabel2 = new JLabel();

JCheckBox jCheckBox1 = new JCheckBox();

JCheckBox jCheckBox2 = new JCheckBox()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值