import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class TotalTest extends JFrame
{
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
JPanel panel4 = new JPanel();
JPanel panel5 = new JPanel();
JPanel panel6 = new JPanel();
JLabel id, password, name, sex, hobby, hp, intro, etc1, etc2, bar1, bar2;
JTextField tf_id, tf_pw, tf_name, tf_hp1, tf_hp2, tf_intro;
JRadioButton male, female;
ButtonGroup bg;
JCheckBox trip, reading;
JComboBox<String> hp_cb;
String hp_num[] = {"010","011","016","019"};
JButton send, cancel;
public TotalTest()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(400, 300);
this.setVisible(true);
GridLayout grid = new GridLayout(6, 1);
setLayout(grid);
id = new JLabel("아이디");
tf_id = new JTextField(8);
etc1 = new JLabel("*8자 이내");
panel1.add(id);
panel1.add(tf_id);
panel1.add(etc1);
password = new JLabel("비밀번호");
tf_pw = new JTextField(8);
name = new JLabel("성명");
tf_name = new JTextField(8);
panel2.add(password);
panel2.add(tf_pw);
panel2.add(name);
panel2.add(tf_name);
sex = new JLabel("성별");
male = new JRadioButton("남");
female = new JRadioButton("여");
bg = new ButtonGroup();
bg.add(male);
bg.add(female);
hobby = new JLabel("취미");
trip = new JCheckBox("여행");
reading = new JCheckBox("독서");
panel3.add(sex);
panel3.add(male);
panel3.add(female);
panel3.add(hobby);
panel3.add(trip);
panel3.add(reading);
hp = new JLabel("H.P");
hp_cb = new JComboBox<>(hp_num);
tf_hp1 = new JTextField(3);
tf_hp2 = new JTextField(3);
bar1 = new JLabel("-");
bar2 = new JLabel("-");
etc2 = new JLabel("*필수입력");
panel4.add(hp);
panel4.add(hp_cb);
panel4.add(bar1);
panel4.add(tf_hp1);
panel4.add(bar2);
panel4.add(tf_hp2);
panel4.add(etc2);
intro = new JLabel("자기소개");
tf_intro = new JTextField(20);
panel5.add(intro);
panel5.add(tf_intro);
send = new JButton("전송");
cancel = new JButton("취소");
panel6.add(send);
panel6.add(cancel);
this.add(panel1);
this.add(panel2);
this.add(panel3);
this.add(panel4);
this.add(panel5);
this.add(panel6);
}
public static void main(String[] args)
{
new TotalTest();
}
}
댓글 없음:
댓글 쓰기