자바초보 질문드려요 (__) pack()에 대해..
꽃짱구
자바킹왕짱초보입니다.
스윙으로 회원가입창을 만들었는데요.
pack() 메소드가 먹히질않아요. pack()의 의미는 책과 검색을 통해 알겠는데
매번 스윙창을 만들때마다 pack()이 안먹혀서 못쓰고있어요 ㅠㅠ아래 소스에 왜 pack()이 안먹히는지 좀 알려주세요 ㅠㅠimport java.awt.Color;
import java.awt.Container;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class SignUp {
public static void main(String[] args){
Member sign = new Member(회 원 가 입);
//sign.setBounds(300,150,250,450);
sign.pack();
sign.setVisible(true);
}
}
class Member extends JFrame {
Container ca;
JLabel jl1, jl2, jl3,jl4,jl5,jl6,jl7,jl8;
JTextField jf1, jf2, jf3, jf4;
JPasswordField pass;
JRadioButton jr1, jr2;
JComboBox jc;
JButton jb1, jb2, jb3;
JPanel jp,jp1;
String str;
public Member (String str){
super(str);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setUI();
}
public void setUI(){
ca = getContentPane();
ca.setLayout(null);
ca.setBackground(Color.getHSBColor(20,20,10));
jl1 = new JLabel(회 원 가 입);
jl1.setBounds(0,20,250,22);
Font fn = new Font(HY엽서L,Font.BOLD, 24);
jl1.setFont(fn);
jl1.setHorizontalAlignment(JLabel.CENTER);
ca.add(jl1);
jp1 = new JPanel();
jp1.setLayout(null);
jp1.setBackground(Color.getHSBColor(20,20,10));
//LineBorder lb = new LineBorder(Color.GRAY,2);
//jp1.setBorder(lb);
jp1.setBounds(0,55,242,180);
jl2 = new JLabel( 아 이 디);
jl2.setBounds(0,18,100,17);
Font ff = new Font(HY엽서L,Font.BOLD, 14);
jl2.setFont(ff);
jl2.setVerticalAlignment(JLabel.CENTER);
jp1.add(jl2);
jf1 = new JTextField();
jf1.setBounds(100,18,130,22);
jp1.add(jf1);
jl3 = new JLabel( 비밀번호);
jl3.setBounds(0,48,250,22);
jl3.setFont(ff);
jl3.setVerticalAlignment(JLabel.CENTER);
jp1.add(jl3);
pass = new JPasswordField();
pass.setBounds(100,48,130,22);
jp1.add(pass);
jl4 = new JLabel( 이 름 );
jl4.setBounds(0,78,250,22);
jl4.setFont(ff);
jl4.setVerticalAlignment(JLabel.CENTER);
jp1.add(jl4);
jf2 = new JTextField();
jf2.setBounds(100,78,130,22);
jp1.add(jf2);
jl5 = new JLabel( 전화번호);
jl5.setBounds(0,108,250,22);
jl5.setFont(ff);
jl5.setVerticalAlignment(JLabel.CENTER);
jp1.add(jl5);
jf3 = new JTextField();
jf3.setBounds(100,108,130,22);
jp1.add(jf3);
jl6 = new JLabel( 주 소 );
jl6.setBounds(0,138,250,22);
jl6.setFont(ff);
jl6.setVerticalAlignment(JLabel.CENTER);
jp1.add(jl6);
jf4 = new JTextField();
jf4.setBounds(100,138,130,22);
jp1.add(jf4);
ca.add(jp1);
jl7 = new JLabel( 선호장르 );
jl7.setBounds(0,255,250,22);
jl7.setFont(ff);
jl7.setVerticalAlignment(JLabel.CENTER);
ca.add(jl7);
String[] str = {소설,시 / 에세이,아동문학,컴퓨터 / IT,만화};
jc = new JComboBox(str);
jc.setFont(ff);
jc.setBounds(100,255,130,22);
ca.add(jc);
jp = new JPanel();
jp.setLayout(null);
jp.setBackground(Color.getHSBColor(20,20,10));
ButtonGroup gr = new ButtonGroup();
jr1 = new JRadioButton(남자,true);
jr1.setBackground(Color.getHSBColor(20,20,10));
jr1.setFont(ff);
jr2 = new JRadioButton(여자,false);
jr2.setBackground(Color.getHSBColor(20,20,10));
jr2.setFont(ff);
gr.add(jr1);
jr1.setBounds(5,5,100,50);
gr.add(jr2);
jr2.setBounds(105,5,100,50);
jl7 = new JLabel(성 별 );
jl7.setFont(ff);
jp.add(jl7);
jp.add(jr1); jp.add(jr2);
jp.setBounds(0,280,250,42);
ca.add(jp);
jb1 = new JButton(다시쓰기);
jb1.setBounds(7,375,95,35);
jb1.setFont(ff);
jb1.addActionListener(new Jb1());
ca.add(jb1);
jb2 = new JButton(완료);
jb2.setBounds(104,375,65,35);
jb2.setFont(ff);
ca.add(jb2);
jb3 = new JButton(취소);
jb3.setBounds(171,375,65,35);
jb3.setFont(ff);
jb3.addActionListener(new Jb3());
ca.add(jb3);
}
public class Jb1 implements ActionListener{
public void actionPerformed(Acormed(ActionEvent e){
jf1.setText();
jf2.setText();
jf3.setText();
jf4.setText();
pass.setText();
}
}
public class Jb3 implements ActionListener{
public void actionPerformed(ActionEvent e){
System.exit(0);
}
}
}