网站首页 语言 会计 电脑 医学 资格证 职场 文艺体育 范文
当前位置:书香门第 > 计算机 > java语言

java的swing单选框用法示例

栏目: java语言 / 发布于: / 人气:3W

本文实例讲述了java之swing单选框用法。具体如下:

java的swing单选框用法示例

import .*;import g.*;import t.*;public class test extends JAppletimplements ActionListener{ JTextField jtf; public void init(){ Container contentPane = getContentPane(); ayout(new FlowLayout()); JRadioButton b1 = new JRadioButton("A"); ctionListener(this); (b1); JRadioButton b2 = new JRadioButton("B"); ctionListener(this); (b2); JRadioButton b3 = new JRadioButton("C"); ctionListener(this); (b3); ButtonGroup bg = new ButtonGroup(); (b1); (b2); (b3); jtf = new JTextField(15); (jtf); } public void actionPerformed(ActionEvent ae){ ext(ctionCommand()); }}