본문 바로가기
프로그래밍/JAVA

자바 로그인 예제

by ITPro 2010. 8. 11.
import java.awt.*;

public class Login extends Frame{
	TextField t1=new TextField("      ");
	TextField t2=new TextField("      ");
	Button b1=new Button("확인");
	Button b2=new Button("취소");
	
	Label l1=new Label("ID");
	Label l2=new Label("password");
	Label l3=new Label(); Label l4=new Label(); Label l5=new Label();
	
	Panel p1=new Panel(); Panel p2=new Panel(); Panel p3=new Panel();
	
	GridLayout g1=new GridLayout(1,5);
	Login(){
		super("로그인");
		init();
		pack();
		setVisible(true);
	}
	void init(){
		p3.add(l1); p3.add(t1);
		p2.add(l2); p2.add(t2);
		// p1.setLayout(g1);
		p1.add(l3); p1.add(b1); p1.add(l4); p1.add(b2); p1.add(l5);
		
		this.add("North",p3);
		this.add("Center",p2);
		this.add("South",p1);
	}
	public static void main(String args[]){
		Login a=new Login();
	}	

}
반응형

바로가기