sw3.java
来自「swing.rar」· Java 代码 · 共 44 行
JAVA
44 行
/*
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 + =
减小字号Ctrl + -
显示快捷键?