網站首頁 語言 會計 網際網路計算機 醫學 學歷 職場 文藝體育 範文
當前位置:學識谷 > 計算機 > java語言

java的swing單選框用法示例

欄目: java語言 / 釋出於: / 人氣:2.81W

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