import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
public class RadioButtonTest extends JFrame
{
JPanel panel;
JLabel label;
JRadioButton male, female;
public RadioButtonTest()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 200);
this.setVisible(true);
panel = new JPanel();
label = new JLabel("성별 : ");
male = new JRadioButton("남");
female = new JRadioButton("여");
panel.add(label);
panel.add(male);
panel.add(female);
add(panel);
}
public static void main(String[] args)
{
new RadioButtonTest();
}
}
result)
댓글 없음:
댓글 쓰기