import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test {
public static void main(String[] args) {
JFrame f = new JFrame("西南財經大學職工");
JPanel contentpane = new JPanel();
contentpane.setLayout(new FlowLayout(FlowLayout.LEFT));
ImageIcon icon = new ImageIcon("woker,dif");
JLabel l1 = new JLabel("姓名 職工編號信息");
l1.setIcon(icon);//這裏分開設置
JLabel l2 = new JLabel("妳有哪些興趣愛好?");
JTextField tf = new JTextField("四川省成都市");
JRadioButton rad1 = new JRadioButton("男");
JRadioButton rad2 = new JRadioButton("女");
JCheckBox c1 = new JCheckBox("籃球", false);
JCheckBox c2 = new JCheckBox("音樂", false);
JCheckBox c3 = new JCheckBox("舞蹈", false);
JCheckBox c4 = new JCheckBox("主持", false);
ButtonGroup bg1 = new ButtonGroup();
bg1.add(rad1);
bg1.add(rad2);
JTextArea ta = new JTextArea("個人簡介信息");
contentpane.add(l1);
contentpane.add(tf);
contentpane.add(ta);
contentpane.add(l2);
contentpane.add(rad1);//添加rad就行了,不能添加按鈕組的
contentpane.add(rad2);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(600, 400);
f.setContentPane(contentpane);
f.setVisible(true);
}
}