COMPLETE SOURCE CODE FOR : TTKH.java
BY : Phi
*********************************************************************
/**
* @(#)TTKH.java
*
* TTKH application
*
* @author
* @version 1.00 2010/3/21
*/
import javax.swing.*;
import java.awt.*;
public class TTKH {
public static void main(String[] args) {
try {
// Set System L&F
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
}
catch (UnsupportedLookAndFeelException e) {
// handle exception
}
catch (ClassNotFoundException e) {
// handle exception
}
catch (InstantiationException e) {
// handle exception
}
catch (IllegalAccessException e) {
// handle exception
}
//=----------------------------------------------------
// TODO, add your application code
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JPanel khungchitiet = new JPanel();
//JPanel p1 = new JPanel();
//JPanel p2 = new JPanel();
//p2.setLayout(new FlowLayout());
JPanel khungtimkiem = new JPanel();
GridLayout g2 = new GridLayout(2,2);
khungtimkiem.setLayout(new GridLayout(5,2,10,10));
GridLayout g1 = new GridLayout(1,1);
khungchitiet.setLayout(new GridLayout(7,2,10,10));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setLocationByPlatform(true);
frame.setSize(680,470);
// Giao dien
JLabel ldemuc = new JLabel("Thong Tin Khach Hang");
ldemuc.setFont(new Font("Tahoma", Font.BOLD, 25));
ldemuc.setLayout(new FlowLayout());
panel.add(ldemuc);
// Khung Chi tiet
JLabel ltenKH = new JLabel("Ten KH");
JTextField ttenKH = new JTextField("Nguyen Van A",1);
JLabel lngaynhan = new JLabel("Ngay Nhan Phong");
JTextField tngaynhan = new JTextField("12/05/2009",1);
JLabel lngaysinh = new JLabel("Ngay Sinh");
JTextField tngaysinh = new JTextField("11/09/1986",1);
JLabel lngaytra = new JLabel("Ngay Tra Phong") ;
JTextField tngaytra = new JTextField("22/05/2009",1);
JLabel lgioitinh = new JLabel("Gioi Tinh");
JTextField tgioitinh = new JTextField("Nam",1);
JLabel lsodt = new JLabel("So Dien Thoai");
JTextField tsodt = new JTextField("0912345677",1);
JLabel lloaiphong = new JLabel("Loai Phong");
JTextField tloaiphong = new JTextField("Vip",1);
JLabel lcmnd = new JLabel("So CMND");
JTextField tcmnd = new JTextField("036365888",1);
JLabel lmaKH = new JLabel("Ma KH");
JTextField tmaKH = new JTextField("001",1);
JLabel lemail = new JLabel("Email");
JTextField temail = new JTextField("nguoidep@gmail.com",1);
JLabel lspace = new JLabel("--------------");
JLabel lspace1 = new JLabel(" ");
JLabel lspace2 = new JLabel("");
JLabel lspace3 = new JLabel("--------------");
JLabel lspace4 = new JLabel(" ");
JLabel lspace5 = new JLabel(" ");
JLabel lchitiet = new JLabel("Chi Tiet Khach Hang") ;
lchitiet.setFont(new Font("Tahoma", Font.BOLD, 15));
JLabel ltimkiem = new JLabel("Tim Kiem Nhanh") ;
ltimkiem.setFont(new Font("Tahoma", Font.BOLD, 15));
khungchitiet.add(lchitiet);
khungchitiet.add(lspace);
khungchitiet.add(lspace1);
khungchitiet.add(lspace2);
//khungchitiet.add(lspace3);
khungchitiet.add(lmaKH);
khungchitiet.add(tmaKH);
khungchitiet.add(lngaynhan);
khungchitiet.add(tngaynhan);
khungchitiet.add(ltenKH);
khungchitiet.add(ttenKH);
khungchitiet.add(lngaytra);
khungchitiet.add(tngaytra);
khungchitiet.add(lgioitinh);
khungchitiet.add(tgioitinh);
khungchitiet.add(lsodt);
khungchitiet.add(tsodt);
khungchitiet.add(lngaysinh);
khungchitiet.add(tngaysinh);
khungchitiet.add(lloaiphong);
khungchitiet.add(tloaiphong);
khungchitiet.add(lcmnd);
khungchitiet.add(tcmnd);
khungchitiet.add(lemail);
khungchitiet.add(temail);
khungchitiet.add(ltimkiem);
khungchitiet.add(lspace3);
khungchitiet.add(lspace4);
khungchitiet.add(lspace5);
// phan tim kiem
JLabel lmaKH2 = new JLabel("Ma KH");
lmaKH2.setForeground(Color.red);
JTextField tmaKH2 = new JTextField("Nhap ma khach hang...");
Choice c1 = new Choice();
c1.addItem("Vip");
c1.addItem("Phong Gia dinh");
c1.addItem("Phong Quat");
c1.addItem("Phong May lanh");
//JLabel lgioitinh2 = new JLabel("Gioi tinh");
//JRadioButton rnam = new JRadioButton("Nam",true);
//JRadioButton rnu = new JRadioButton("Nu",false);
JLabel lngaynhan2 = new JLabel("Ngay Nhan");
lngaynhan2.setForeground(Color.red);
JTextField tngaynhan2 = new JTextField("Nhap ngay nhan dd/mm/yyyy");
JLabel lcmnd2 = new JLabel("So CMND");
JTextField tcmnd2 = new JTextField("Nhap so");
JLabel lngaytra2 = new JLabel("Ngay Tra");
lngaytra2.setForeground(Color.red);
JTextField tngaytra2 = new JTextField("Nhap ngay tra dd/mm/yyyy");
JLabel ltenKH2 = new JLabel("Ten KH");
JTextField ttenKH2 = new JTextField("Nhap ten KH");
JLabel ls1 = new JLabel(" ");
JLabel ls2 = new JLabel(" ");
JLabel ls3 = new JLabel(" ");
JLabel ls4 = new JLabel(" ");
JLabel ls5 = new JLabel(" ");
JLabel ls6 = new JLabel(" ");
JButton b1 = new JButton("Lam Moi");
JButton b2 = new JButton("Tim");
JButton b3 = new JButton("Thoat");
//JLabel ls5 = new JLabel(" ");
JLabel loaiphong = new JLabel("Loai Phong");
khungtimkiem.add(lmaKH2);
khungtimkiem.add(tmaKH2);
khungtimkiem.add(lngaynhan2);
khungtimkiem.add(tngaynhan2);
khungtimkiem.add(ltenKH2);
khungtimkiem.add(ttenKH2);
khungtimkiem.add(lngaytra2);
khungtimkiem.add(tngaytra2);
khungtimkiem.add(lcmnd2);
khungtimkiem.add(tcmnd2);
khungtimkiem.add(ls1);
khungtimkiem.add(ls2);
khungtimkiem.add(loaiphong);
khungtimkiem.add(c1);
khungtimkiem.add(ls3);
khungtimkiem.add(b2);
khungtimkiem.add(ls5);
khungtimkiem.add(ls6);
khungtimkiem.add(b1);
khungtimkiem.add(b3);
frame.setLayout(new BorderLayout());
frame.add(panel, BorderLayout.NORTH);
//frame.add(p1, BorderLayout.LINE_START);
frame.add(khungchitiet, BorderLayout.WEST);
//frame.add(p2, BorderLayout.WEST);
//frame.add(p2, BorderLayout.LINE_END);
frame.add(khungtimkiem, BorderLayout.SOUTH);
frame.setVisible(true);
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************