⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sw3.java

📁 swing.rar
💻 JAVA
字号:
/*
JRadioButton
	class
cons:
	JRadioButton()
	JRadioButton(String)

Note:
	If we don't group the JRadioButton then it works like Checkbox

ButtonGroup
	Class
	Used to group the JRadioButtons

Cons:
	ButtonGroup()
Method:
	add(JRadioButton)
*/

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class sw3 extends JFrame
{
	JRadioButton b1 = new JRadioButton("Male");
	JRadioButton b2 = new JRadioButton("Female");

	public sw3()
	{
		Container con = getContentPane();
			con.add(b1);
			con.add(b2);
		con.setLayout(new FlowLayout());
		setSize(300,300);
		setVisible(true);
	}

	public static void main(String args[])
	{
		new sw3();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -