當前位置:才華齋>計算機>java語言>

java的swing單選框用法示例

java語言 閱讀(2.93W)

本文例項講述了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()); }}