jav view
package org.hvbk.test.view;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.BorderLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.SwingConstants;
import java.awt.Insets;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
public class DiemthisinhvienView extends JPanel {
private static final long serialVersionUID = 1L;
private JPanel pnlButton = null;
private JButton btnSua = null;
private JButton btnXoa = null;
private JButton btnBoqua = null;
private JButton btnChapnhan = null;
private JButton btnThoat = null;
private JPanel pnlDanhsach = null;
private JTable tblBangdulieu = null;
private JPanel pnlThongtin = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JTextField txtMaso = null;
private JComboBox cboHocki = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JTextField txtHoten = null;
private JComboBox cboNamhoc = null;
private JLabel jLabel4 = null;
/**
* This is the default constructor
*/
public DiemthisinhvienView() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(666, 557);
this.setLayout(new BorderLayout());
this.add(getPnlButton(), BorderLayout.SOUTH);
this.add(getPnlDanhsach(), BorderLayout.CENTER);
this.add(getPnlThongtin(), BorderLayout.NORTH);
}
/**
* This method initializes pnlButton
*
* @return javax.swing.JPanel
*/
private JPanel getPnlButton() {
if (pnlButton == null) {
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.anchor = GridBagConstraints.EAST;
gridBagConstraints4.gridheight = 1;
gridBagConstraints4.weightx = 1.0;
gridBagConstraints4.ipadx = 0;
gridBagConstraints4.insets = new Insets(5, 0, 5, 5);
gridBagConstraints4.gridwidth = 1;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 4;
gridBagConstraints3.anchor = GridBagConstraints.EAST;
gridBagConstraints3.gridwidth = 1;
gridBagConstraints3.gridheight = 1;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.ipadx = 0;
gridBagConstraints3.insets = new Insets(5, 0, 5, 5);
gridBagConstraints3.gridy = 0;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 3;
gridBagConstraints2.anchor = GridBagConstraints.EAST;
gridBagConstraints2.gridwidth = 1;
gridBagConstraints2.gridheight = 1;
gridBagConstraints2.weightx = 1.0;
gridBagConstraints2.ipadx = 0;
gridBagConstraints2.insets = new Insets(5, 0, 5, 5);
gridBagConstraints2.gridy = 0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 2;
gridBagConstraints1.anchor = GridBagConstraints.EAST;
gridBagConstraints1.gridwidth = 1;
gridBagConstraints1.gridheight = 1;
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.ipadx = 0;
gridBagConstraints1.insets = new Insets(5, 0, 5, 5);
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.anchor = GridBagConstraints.EAST;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.gridheight = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.ipadx = 0;
gridBagConstraints.insets = new Insets(5, 0, 5, 5);
gridBagConstraints.gridy = 0;
pnlButton = new JPanel();
pnlButton.setLayout(new GridBagLayout());
pnlButton.add(getBtnSua(), gridBagConstraints4);
pnlButton.add(getBtnXoa(), gridBagConstraints);
pnlButton.add(getBtnBoqua(), gridBagConstraints1);
pnlButton.add(getBtnChapnhan(), gridBagConstraints2);
pnlButton.add(getBtnThoat(), gridBagConstraints3);
}
return pnlButton;
}
/**
* This method initializes btnSua
*
* @return javax.swing.JButton
*/
private JButton getBtnSua() {
if (btnSua == null) {
btnSua = new JButton();
btnSua.setText("Sá»a");
btnSua.setHorizontalAlignment(SwingConstants.CENTER);
btnSua.setPreferredSize(new Dimension(94, 26));
}
return btnSua;
}
/**
* This method initializes btnXoa
*
* @return javax.swing.JButton
*/
private JButton getBtnXoa() {
if (btnXoa == null) {
btnXoa = new JButton();
btnXoa.setText("Xóa");
btnXoa.setHorizontalAlignment(SwingConstants.CENTER);
btnXoa.setPreferredSize(new Dimension(94, 26));
}
return btnXoa;
}
/**
* This method initializes btnBoqua
*
* @return javax.swing.JButton
*/
private JButton getBtnBoqua() {
if (btnBoqua == null) {
btnBoqua = new JButton();
btnBoqua.setText("B� qua");
btnBoqua.setHorizontalAlignment(SwingConstants.CENTER);
btnBoqua.setPreferredSize(new Dimension(94, 26));
}
return btnBoqua;
}
/**
* This method initializes btnChapnhan
*
* @return javax.swing.JButton
*/
private JButton getBtnChapnhan() {
if (btnChapnhan == null) {
btnChapnhan = new JButton();
btnChapnhan.setText("Chấp nháºn");
btnChapnhan.setHorizontalAlignment(SwingConstants.CENTER);
btnChapnhan.setPreferredSize(new Dimension(94, 26));
}
return btnChapnhan;
}
/**
* This method initializes btnThoat
*
* @return javax.swing.JButton
*/
private JButton getBtnThoat() {
if (btnThoat == null) {
btnThoat = new JButton();
btnThoat.setText("Thoát");
btnThoat.setHorizontalAlignment(SwingConstants.CENTER);
btnThoat.setPreferredSize(new Dimension(94, 26));
}
return btnThoat;
}
/**
* This method initializes pnlDanhsach
*
* @return javax.swing.JPanel
*/
private JPanel getPnlDanhsach() {
if (pnlDanhsach == null) {
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.fill = GridBagConstraints.BOTH;
gridBagConstraints5.weighty = 1.0;
gridBagConstraints5.weightx = 1.0;
pnlDanhsach = new JPanel();
pnlDanhsach.setLayout(new GridBagLayout());
pnlDanhsach.add(getTblBangdulieu(), gridBagConstraints5);
}
return pnlDanhsach;
}
/**
* This method initializes tblBangdulieu
*
* @return javax.swing.JTable
*/
private JTable getTblBangdulieu() {
if (tblBangdulieu == null) {
tblBangdulieu = new JTable();
}
return tblBangdulieu;
}
/**
* This method initializes pnlThongtin
*
* @return javax.swing.JPanel
*/
private JPanel getPnlThongtin() {
if (pnlThongtin == null) {
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.anchor = GridBagConstraints.WEST;
gridBagConstraints14.insets = new Insets(5, 5, 5, 0);
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.gridx = 4;
gridBagConstraints13.anchor = GridBagConstraints.WEST;
gridBagConstraints13.insets = new Insets(5, 5, 5, 0);
gridBagConstraints13.ipadx = 163;
gridBagConstraints13.gridy = 1;
jLabel4 = new JLabel();
jLabel4.setText("");
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints12.gridy = 1;
gridBagConstraints12.weightx = 1.0;
gridBagConstraints12.insets = new Insets(5, 5, 5, 5);
gridBagConstraints12.ipadx = 0;
gridBagConstraints12.gridx = 3;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 0;
gridBagConstraints11.weightx = 1.0;
gridBagConstraints11.gridwidth = 2;
gridBagConstraints11.insets = new Insets(5, 5, 5, 5);
gridBagConstraints11.gridx = 3;
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.gridx = 2;
gridBagConstraints10.anchor = GridBagConstraints.WEST;
gridBagConstraints10.insets = new Insets(5, 5, 5, 0);
gridBagConstraints10.gridy = 1;
jLabel3 = new JLabel();
jLabel3.setText("Năm h�c");
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
gridBagConstraints9.gridx = 2;
gridBagConstraints9.anchor = GridBagConstraints.WEST;
gridBagConstraints9.insets = new Insets(5, 5, 5, 0);
gridBagConstraints9.gridy = 0;
jLabel2 = new JLabel();
jLabel2.setText("H� tên");
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints8.gridy = 1;
gridBagConstraints8.weightx = 1.0;
gridBagConstraints8.insets = new Insets(5, 5, 5, 5);
gridBagConstraints8.gridx = 1;
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints7.gridy = 0;
gridBagConstraints7.weightx = 1.0;
gridBagConstraints7.insets = new Insets(5, 5, 5, 5);
gridBagConstraints7.gridx = 1;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.gridx = 0;
gridBagConstraints6.anchor = GridBagConstraints.WEST;
gridBagConstraints6.insets = new Insets(5, 5, 5, 0);
gridBagConstraints6.gridy = 1;
jLabel1 = new JLabel();
jLabel1.setText("H�c kì");
jLabel = new JLabel();
jLabel.setText("Mã số");
pnlThongtin = new JPanel();
pnlThongtin.setLayout(new GridBagLayout());
pnlThongtin.add(jLabel, gridBagConstraints14);
pnlThongtin.add(jLabel1, gridBagConstraints6);
pnlThongtin.add(getTxtMaso(), gridBagConstraints7);
pnlThongtin.add(getCboHocki(), gridBagConstraints8);
pnlThongtin.add(jLabel2, gridBagConstraints9);
pnlThongtin.add(jLabel3, gridBagConstraints10);
pnlThongtin.add(getTxtHoten(), gridBagConstraints11);
pnlThongtin.add(getCboNamhoc(), gridBagConstraints12);
pnlThongtin.add(jLabel4, gridBagConstraints13);
}
return pnlThongtin;
}
/**
* This method initializes txtMaso
*
* @return javax.swing.JTextField
*/
private JTextField getTxtMaso() {
if (txtMaso == null) {
txtMaso = new JTextField();
}
return txtMaso;
}
/**
* This method initializes cboHocki
*
* @return javax.swing.JComboBox
*/
private JComboBox getCboHocki() {
if (cboHocki == null) {
cboHocki = new JComboBox();
}
return cboHocki;
}
/**
* This method initializes txtHoten
*
* @return javax.swing.JTextField
*/
private JTextField getTxtHoten() {
if (txtHoten == null) {
txtHoten = new JTextField();
}
return txtHoten;
}
/**
* This method initializes cboNamhoc
*
* @return javax.swing.JComboBox
*/
private JComboBox getCboNamhoc() {
if (cboNamhoc == null) {
cboNamhoc = new JComboBox();
}
return cboNamhoc;
}
public JLabel getJLabel() {
return jLabel;
}
public void setJLabel(JLabel label) {
jLabel = label;
}
public JLabel getJLabel1() {
return jLabel1;
}
public void setJLabel1(JLabel label1) {
jLabel1 = label1;
}
public JLabel getJLabel2() {
return jLabel2;
}
public void setJLabel2(JLabel label2) {
jLabel2 = label2;
}
public JLabel getJLabel3() {
return jLabel3;
}
public void setJLabel3(JLabel label3) {
jLabel3 = label3;
}
public JLabel getJLabel4() {
return jLabel4;
}
public void setJLabel4(JLabel label4) {
jLabel4 = label4;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public void setPnlButton(JPanel pnlButton) {
this.pnlButton = pnlButton;
}
public void setBtnSua(JButton btnSua) {
this.btnSua = btnSua;
}
public void setBtnXoa(JButton btnXoa) {
this.btnXoa = btnXoa;
}
public void setBtnBoqua(JButton btnBoqua) {
this.btnBoqua = btnBoqua;
}
public void setBtnChapnhan(JButton btnChapnhan) {
this.btnChapnhan = btnChapnhan;
}
public void setBtnThoat(JButton btnThoat) {
this.btnThoat = btnThoat;
}
public void setPnlDanhsach(JPanel pnlDanhsach) {
this.pnlDanhsach = pnlDanhsach;
}
public void setTblBangdulieu(JTable tblBangdulieu) {
this.tblBangdulieu = tblBangdulieu;
}
public void setPnlThongtin(JPanel pnlThongtin) {
this.pnlThongtin = pnlThongtin;
}
public void setTxtMaso(JTextField txtMaso) {
this.txtMaso = txtMaso;
}
public void setCboHocki(JComboBox cboHocki) {
this.cboHocki = cboHocki;
}
public void setTxtHoten(JTextField txtHoten) {
this.txtHoten = txtHoten;
}
public void setCboNamhoc(JComboBox cboNamhoc) {
this.cboNamhoc = cboNamhoc;
}
} // @jve:decl-index=0:visual-constraint="10,10"
---------------------------------------------------------------------------------------------------------------------------------
package org.hvbk.test.view;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionListener;
import javax.swing.ComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableModel;
import org.hvbk.test.bean.Hocsinh;
import org.jdesktop.swingx.JXDatePicker;
public class HocsinhView extends JPanel {
private static final long serialVersionUID = 1L;
private JPanel pnlButton = null;
private JButton btnNhapdiemthi = null;
private JButton btnThem = null;
private JButton btnSua = null;
private JButton btnXoa = null;
private JButton btnBoqua = null;
private JButton btnGhi = null;
private JButton btnThoat = null;
private JPanel pnlThongtin = null;
private JPanel pnlThongtinSV = null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JTextField txtMaso = null;
private JTextField txtTen = null;
private JTextField txtSoCMT = null;
private JTextField txtDiachi = null;
private JComboBox cboKhoa = null;
private JTextField txtNamnhaphoc = null;
private JLabel jLabel6 = null;
private JTextField txtNamtotnghiep = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JLabel jLabel9 = null;
private JLabel jLabel10 = null;
private JLabel jLabel11 = null;
private JTextField txtHo = null;
private JXDatePicker txtNgaysinh = null;
private JTextField txtNoisinh = null;
private JTextField txtNoitamtru = null;
private JComboBox cboNghanh = null;
private JLabel jLabel12 = null;
private JTextField txtGiotinh = null;
private JScrollPane jScrollPane = null;
private JTable tblBangdulieu = null;
/**
* This is the default constructor
*/
public HocsinhView() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(671, 598);
this.setLayout(new BorderLayout());
this.add(getPnlButton(), BorderLayout.SOUTH);
this.add(getPnlThongtin(), BorderLayout.NORTH);
this.add(getJScrollPane(), BorderLayout.CENTER);
}
/**
* This method initializes pnlButton
*
* @return javax.swing.JPanel
*/
private JPanel getPnlButton() {
if (pnlButton == null) {
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.insets = new Insets(5, 5, 5, 0);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.gridx = 6;
gridBagConstraints5.insets = new Insets(5, 5, 5, 5);
gridBagConstraints5.gridy = 0;
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.gridx = 5;
gridBagConstraints4.insets = new Insets(5, 5, 5, 5);
gridBagConstraints4.gridy = 0;
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 4;
gridBagConstraints3.insets = new Insets(5, 5, 5, 5);
gridBagConstraints3.gridy = 0;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 3;
gridBagConstraints2.insets = new Insets(5, 5, 5, 5);
gridBagConstraints2.gridy = 0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 2;
gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
gridBagConstraints1.gridy = 0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.anchor = GridBagConstraints.EAST;
gridBagConstraints.insets = new Insets(5, 0, 5, 5);
gridBagConstraints.gridy = 0;
pnlButton = new JPanel();
pnlButton.setLayout(new GridBagLayout());
pnlButton.add(getBtnNhapdiemthi(), gridBagConstraints6);
pnlButton.add(getBtnThem(), gridBagConstraints);
pnlButton.add(getBtnSua(), gridBagConstraints1);
pnlButton.add(getBtnXoa(), gridBagConstraints2);
pnlButton.add(getBtnBoqua(), gridBagConstraints3);
pnlButton.add(getBtnGhi(), gridBagConstraints4);
pnlButton.add(getBtnThoat(), gridBagConstraints5);
}
return pnlButton;
}
/**
* This method initializes btnNhapdiemthi
*
* @return javax.swing.JButton
*/
private JButton getBtnNhapdiemthi() {
if (btnNhapdiemthi == null) {
btnNhapdiemthi = new JButton();
btnNhapdiemthi.setText("Nháºp Ä‘iểm thi");
}
return btnNhapdiemthi;
}
/**
* This method initializes btnThem
*
* @return javax.swing.JButton
*/
private JButton getBtnThem() {
if (btnThem == null) {
btnThem = new JButton();
btnThem.setText("Thêm");
btnThem.setPreferredSize(new Dimension(73, 26));
}
return btnThem;
}
/**
* This method initializes btnSua
*
* @return javax.swing.JButton
*/
private JButton getBtnSua() {
if (btnSua == null) {
btnSua = new JButton();
btnSua.setText("Sá»a");
btnSua.setPreferredSize(new Dimension(73, 26));
}
return btnSua;
}
/**
* This method initializes btnXoa
*
* @return javax.swing.JButton
*/
private JButton getBtnXoa() {
if (btnXoa == null) {
btnXoa = new JButton();
btnXoa.setText("Xóa");
btnXoa.setPreferredSize(new Dimension(73, 26));
}
return btnXoa;
}
/**
* This method initializes btnBoqua
*
* @return javax.swing.JButton
*/
private JButton getBtnBoqua() {
if (btnBoqua == null) {
btnBoqua = new JButton();
btnBoqua.setText("B� qua");
btnBoqua.setPreferredSize(new Dimension(73, 26));
}
return btnBoqua;
}
/**
* This method initializes btnGhi
*
* @return javax.swing.JButton
*/
private JButton getBtnGhi() {
if (btnGhi == null) {
btnGhi = new JButton();
btnGhi.setText("Ghi");
btnGhi.setPreferredSize(new Dimension(73, 26));
}
return btnGhi;
}
/**
* This method initializes btnThoat
*
* @return javax.swing.JButton
*/
private JButton getBtnThoat() {
if (btnThoat == null) {
btnThoat = new JButton();
btnThoat.setText("Thoát");
btnThoat.setPreferredSize(new Dimension(73, 26));
}
return btnThoat;
}
/**
* This method initializes pnlThongtin
*
* @return javax.swing.JPanel
*/
private JPanel getPnlThongtin() {
if (pnlThongtin == null) {
GridLayout gridLayout = new GridLayout();
gridLayout.setRows(1);
pnlThongtin = new JPanel();
pnlThongtin.setLayout(gridLayout);
pnlThongtin.add(getPnlThongtinSV(), null);
}
return pnlThongtin;
}
/**
* This method initializes pnlThongtinSV
*
* @return javax.swing.JPanel
*/
private JPanel getPnlThongtinSV() {
if (pnlThongtinSV == null) {
GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
gridBagConstraints33.fill = GridBagConstraints.BOTH;
gridBagConstraints33.gridy = 1;
gridBagConstraints33.weightx = 1.0;
gridBagConstraints33.insets = new Insets(5, 5, 5, 5);
gridBagConstraints33.gridx = 7;
GridBagConstraints gridBagConstraints32 = new GridBagConstraints();
gridBagConstraints32.gridx = 6;
gridBagConstraints32.gridy = 1;
jLabel12 = new JLabel();
jLabel12.setText("Giá»›i tÃnh");
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 4;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.insets = new Insets(5, 5, 5, 5);
gridBagConstraints31.gridwidth = 3;
gridBagConstraints31.gridx = 5;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.weightx = 1.0;
gridBagConstraints30.insets = new Insets(5, 5, 5, 5);
gridBagConstraints30.gridwidth = 3;
gridBagConstraints30.gridx = 5;
GridBagConstraints gridBagConstraints29 = new GridBagConstraints();
gridBagConstraints29.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints29.gridy = 2;
gridBagConstraints29.weightx = 1.0;
gridBagConstraints29.insets = new Insets(5, 5, 5, 5);
gridBagConstraints29.gridwidth = 3;
gridBagConstraints29.gridx = 5;
GridBagConstraints gridBagConstraints28 = new GridBagConstraints();
gridBagConstraints28.fill = GridBagConstraints.BOTH;
gridBagConstraints28.gridy = 1;
gridBagConstraints28.weightx = 1.0;
gridBagConstraints28.insets = new Insets(5, 5, 5, 5);
gridBagConstraints28.gridx = 5;
GridBagConstraints gridBagConstraints27 = new GridBagConstraints();
gridBagConstraints27.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints27.gridy = 0;
gridBagConstraints27.weightx = 1.0;
gridBagConstraints27.insets = new Insets(5, 5, 5, 5);
gridBagConstraints27.gridwidth = 3;
gridBagConstraints27.gridx = 5;
GridBagConstraints gridBagConstraints26 = new GridBagConstraints();
gridBagConstraints26.gridx = 4;
gridBagConstraints26.anchor = GridBagConstraints.WEST;
gridBagConstraints26.insets = new Insets(5, 5, 5, 0);
gridBagConstraints26.gridy = 4;
jLabel11 = new JLabel();
jLabel11.setText("Nghà nh");
GridBagConstraints gridBagConstraints25 = new GridBagConstraints();
gridBagConstraints25.gridx = 4;
gridBagConstraints25.anchor = GridBagConstraints.WEST;
gridBagConstraints25.insets = new Insets(5, 5, 5, 0);
gridBagConstraints25.gridy = 3;
jLabel10 = new JLabel();
jLabel10.setText("Nơi tạm trú");
GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
gridBagConstraints24.gridx = 4;
gridBagConstraints24.anchor = GridBagConstraints.WEST;
gridBagConstraints24.insets = new Insets(5, 5, 5, 0);
gridBagConstraints24.gridy = 2;
jLabel9 = new JLabel();
jLabel9.setText("NÆ¡i sinh");
GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
gridBagConstraints23.gridx = 4;
gridBagConstraints23.anchor = GridBagConstraints.WEST;
gridBagConstraints23.insets = new Insets(5, 5, 5, 0);
gridBagConstraints23.gridy = 1;
jLabel8 = new JLabel();
jLabel8.setText("Ngà y sinh");
GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
gridBagConstraints22.gridx = 4;
gridBagConstraints22.anchor = GridBagConstraints.WEST;
gridBagConstraints22.insets = new Insets(5, 5, 5, 0);
gridBagConstraints22.gridy = 0;
jLabel7 = new JLabel();
jLabel7.setText("H�");
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.anchor = GridBagConstraints.WEST;
gridBagConstraints21.insets = new Insets(5, 5, 5, 0);
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints20.gridy = 5;
gridBagConstraints20.weightx = 1.0;
gridBagConstraints20.insets = new Insets(5, 0, 5, 5);
gridBagConstraints20.gridx = 3;
GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
gridBagConstraints19.gridx = 2;
gridBagConstraints19.insets = new Insets(5, 0, 5, 5);
gridBagConstraints19.gridy = 5;
jLabel6 = new JLabel();
jLabel6.setText("Năm tốt nghiệp");
GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
gridBagConstraints18.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints18.gridy = 5;
gridBagConstraints18.weightx = 1.0;
gridBagConstraints18.insets = new Insets(5, 5, 5, 5);
gridBagConstraints18.gridx = 1;
GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints17.gridy = 4;
gridBagConstraints17.weightx = 1.0;
gridBagConstraints17.gridwidth = 3;
gridBagConstraints17.insets = new Insets(5, 5, 5, 5);
gridBagConstraints17.gridx = 1;
GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
gridBagConstraints16.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints16.gridy = 3;
gridBagConstraints16.weightx = 1.0;
gridBagConstraints16.gridwidth = 3;
gridBagConstraints16.insets = new Insets(5, 5, 5, 5);
gridBagConstraints16.gridx = 1;
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints15.gridy = 2;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridwidth = 3;
gridBagConstraints15.insets = new Insets(5, 5, 5, 5);
gridBagConstraints15.gridx = 1;
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints14.gridy = 1;
gridBagConstraints14.weightx = 1.0;
gridBagConstraints14.gridwidth = 3;
gridBagConstraints14.insets = new Insets(5, 5, 5, 5);
gridBagConstraints14.gridx = 1;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints13.gridy = 0;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.gridwidth = 3;
gridBagConstraints13.insets = new Insets(5, 5, 5, 5);
gridBagConstraints13.gridx = 1;
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.gridx = 0;
gridBagConstraints12.insets = new Insets(5, 5, 5, 0);
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.gridy = 5;
jLabel5 = new JLabel();
jLabel5.setText("Năm nháºp há»�c");
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.insets = new Insets(5, 5, 5, 0);
gridBagConstraints11.anchor = GridBagConstraints.WEST;
gridBagConstraints11.gridy = 4;
jLabel4 = new JLabel();
jLabel4.setText("Khoa");
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.gridx = 0;
gridBagConstraints10.anchor = GridBagConstraints.WEST;
gridBagConstraints10.insets = new Insets(5, 5, 5, 0);
gridBagConstraints10.gridy = 3;
jLabel3 = new JLabel();
jLabel3.setText("�ịa chỉ");
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
gridBagConstraints9.gridx = 0;
gridBagConstraints9.insets = new Insets(5, 5, 5, 0);
gridBagConstraints9.anchor = GridBagConstraints.WEST;
gridBagConstraints9.gridy = 2;
jLabel2 = new JLabel();
jLabel2.setText("Số CMT");
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.gridx = 0;
gridBagConstraints8.anchor = GridBagConstraints.WEST;
gridBagConstraints8.insets = new Insets(5, 5, 5, 0);
gridBagConstraints8.gridy = 1;
jLabel1 = new JLabel();
jLabel1.setText("Tên");
jLabel = new JLabel();
jLabel.setText("Mã số");
pnlThongtinSV = new JPanel();
pnlThongtinSV.setLayout(new GridBagLayout());
pnlThongtinSV.add(jLabel, gridBagConstraints21);
pnlThongtinSV.add(jLabel1, gridBagConstraints8);
pnlThongtinSV.add(jLabel2, gridBagConstraints9);
pnlThongtinSV.add(jLabel3, gridBagConstraints10);
pnlThongtinSV.add(jLabel4, gridBagConstraints11);
pnlThongtinSV.add(jLabel5, gridBagConstraints12);
pnlThongtinSV.add(getTxtMaso(), gridBagConstraints13);
pnlThongtinSV.add(getTxtTen(), gridBagConstraints14);
pnlThongtinSV.add(getTxtSoCMT(), gridBagConstraints15);
pnlThongtinSV.add(getTxtDiachi(), gridBagConstraints16);
pnlThongtinSV.add(getCboKhoa(), gridBagConstraints17);
pnlThongtinSV.add(getTxtNamnhaphoc(), gridBagConstraints18);
pnlThongtinSV.add(jLabel6, gridBagConstraints19);
pnlThongtinSV.add(getTxtNamtotnghiep(), gridBagConstraints20);
pnlThongtinSV.add(jLabel7, gridBagConstraints22);
pnlThongtinSV.add(jLabel8, gridBagConstraints23);
pnlThongtinSV.add(jLabel9, gridBagConstraints24);
pnlThongtinSV.add(jLabel10, gridBagConstraints25);
pnlThongtinSV.add(jLabel11, gridBagConstraints26);
pnlThongtinSV.add(getTxtHo(), gridBagConstraints27);
pnlThongtinSV.add(getTxtNgaysinh(), gridBagConstraints28);
pnlThongtinSV.add(getTxtNoisinh(), gridBagConstraints29);
pnlThongtinSV.add(getTxtNoitamtru(), gridBagConstraints30);
pnlThongtinSV.add(getCboNghanh(), gridBagConstraints31);
pnlThongtinSV.add(jLabel12, gridBagConstraints32);
pnlThongtinSV.add(getTxtGiotinh(), gridBagConstraints33);
}
return pnlThongtinSV;
}
/**
* This method initializes txtMaso
*
* @return javax.swing.JTextField
*/
private JTextField getTxtMaso() {
if (txtMaso == null) {
txtMaso = new JTextField();
}
return txtMaso;
}
/**
* This method initializes txtTen
*
* @return javax.swing.JTextField
*/
private JTextField getTxtTen() {
if (txtTen == null) {
txtTen = new JTextField();
}
return txtTen;
}
/**
* This method initializes txtSoCMT
*
* @return javax.swing.JTextField
*/
private JTextField getTxtSoCMT() {
if (txtSoCMT == null) {
txtSoCMT = new JTextField();
}
return txtSoCMT;
}
/**
* This method initializes txtDiachi
*
* @return javax.swing.JTextField
*/
private JTextField getTxtDiachi() {
if (txtDiachi == null) {
txtDiachi = new JTextField();
}
return txtDiachi;
}
/**
* This method initializes cboKhoa
*
* @return javax.swing.JComboBox
*/
private JComboBox getCboKhoa() {
if (cboKhoa == null) {
cboKhoa = new JComboBox();
}
return cboKhoa;
}
/**
* This method initializes txtNamnhaphoc
*
* @return javax.swing.JTextField
*/
private JTextField getTxtNamnhaphoc() {
if (txtNamnhaphoc == null) {
txtNamnhaphoc = new JTextField();
}
return txtNamnhaphoc;
}
/**
* This method initializes txtNamtotnghiep
*
* @return javax.swing.JTextField
*/
private JTextField getTxtNamtotnghiep() {
if (txtNamtotnghiep == null) {
txtNamtotnghiep = new JTextField();
}
return txtNamtotnghiep;
}
/**
* This method initializes txtHo
*
* @return javax.swing.JTextField
*/
private JTextField getTxtHo() {
if (txtHo == null) {
txtHo = new JTextField();
}
return txtHo;
}
/**
* This method initializes txtNgaysinh
*
* @return javax.swing.JTextField
*/
private JXDatePicker getTxtNgaysinh() {
if (txtNgaysinh == null) {
txtNgaysinh = new JXDatePicker();
}
return txtNgaysinh;
}
/**
* This method initializes txtNoisinh
*
* @return javax.swing.JTextField
*/
private JTextField getTxtNoisinh() {
if (txtNoisinh == null) {
txtNoisinh = new JTextField();
}
return txtNoisinh;
}
/**
* This method initializes txtNoitamtru
*
* @return javax.swing.JTextField
*/
private JTextField getTxtNoitamtru() {
if (txtNoitamtru == null) {
txtNoitamtru = new JTextField();
}
return txtNoitamtru;
}
/**
* This method initializes cboNghanh
*
* @return javax.swing.JComboBox
*/
private JComboBox getCboNghanh() {
if (cboNghanh == null) {
cboNghanh = new JComboBox();
}
return cboNghanh;
}
/**
* This method initializes txtGiotinh
*
* @return javax.swing.JTextField
*/
private JTextField getTxtGiotinh() {
if (txtGiotinh == null) {
txtGiotinh = new JTextField();
}
return txtGiotinh;
}
public JLabel getJLabel() {
return jLabel;
}
public JLabel getJLabel1() {
return jLabel1;
}
public JLabel getJLabel2() {
return jLabel2;
}
public JLabel getJLabel3() {
return jLabel3;
}
public JLabel getJLabel4() {
return jLabel4;
}
public JLabel getJLabel5() {
return jLabel5;
}
public JLabel getJLabel6() {
return jLabel6;
}
public JLabel getJLabel7() {
return jLabel7;
}
public JLabel getJLabel8() {
return jLabel8;
}
public JLabel getJLabel9() {
return jLabel9;
}
public JLabel getJLabel10() {
return jLabel10;
}
public JLabel getJLabel11() {
return jLabel11;
}
public JLabel getJLabel12() {
return jLabel12;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public void doThoat(ActionListener listener) {
this.btnThoat.addActionListener(listener);
}
public void doThem(ActionListener listener) {
this.btnThem.addActionListener(listener);
}
public void doGhi(ActionListener listener) {
this.btnGhi.addActionListener(listener);
}
public void xoaDuLieu() {
this.txtDiachi.setText("");
this.txtGiotinh.setText("");
this.txtHo.setText("");
this.txtMaso.setText("");
this.txtNamnhaphoc.setText("");
this.txtNgaysinh.setDate(null);
}
public void setModel(TableModel model) {
this.tblBangdulieu.setModel(model);
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getTblBangdulieu());
}
return jScrollPane;
}
/**
* This method initializes tblBangdulieu
*
* @return javax.swing.JTable
*/
private JTable getTblBangdulieu() {
if (tblBangdulieu == null) {
tblBangdulieu = new JTable();
}
return tblBangdulieu;
}
public void setTblBangdulieu(JTable tblBangdulieu) {
this.tblBangdulieu = tblBangdulieu;
}
public Hocsinh getHocsinhInfo() {
Hocsinh item = new Hocsinh();
item.setHo(this.txtHo.getText());
item.setMaso(this.txtMaso.getText());
item.setNgaysinh(this.txtNgaysinh.getDate());
item.setTen(this.txtTen.getText());
return item;
}
public int getSelectedRow() {
return this.tblBangdulieu.getSelectedRow();
}
public void doXoa(ActionListener listener) {
this.btnXoa.addActionListener(listener);
}
public void setComboModel(ComboBoxModel model) {
this.cboKhoa.setModel(model);
}
} // @jve:decl-index=0:visual-constraint="10,10"
---------------------------------------------------------------------------------------------------------------------------------
package org.hvbk.test.view;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class Mainview extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JMenuBar jMenuBar = new JMenuBar();
private JMenu file = new JMenu("File");
private JMenuItem mnNew = new JMenuItem("New");
private JMenuItem mnOpenfile = new JMenuItem("Open file");
private JMenuItem mnQuit = new JMenuItem("Quit");
public Mainview() {
super("Main view demo");
setSize(Toolkit.getDefaultToolkit().getScreenSize());
setVisible(true);
setJMenuBar(jMenuBar);
initMenu();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void initMenu() {
file.add(mnNew);
file.add(mnOpenfile);
file.add(mnQuit);
jMenuBar.add(file);
}
public static void main(String[] args) {
new Mainview();
}
public void doNew(ActionListener actionListener) {
mnNew.addActionListener(actionListener);
}
public void doQuit(ActionListener actionListener) {
mnQuit.addActionListener(actionListener);
}
}
---------------------------------------------------------------------------------------------------------------------------------
package org.hvbk.test.view;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class TestView extends JPanel {
private static final long serialVersionUID = 1L;
private JPanel pnlThongtin = null;
private JPanel pnlButton = null;
private JButton btDangnhap = null;
private JButton btThoat = null;
private JLabel lblUser = null;
private JLabel lblPassword = null;
private JTextField txtUser = null;
private JPasswordField txtPassword = null;
/**
* This is the default constructor
*/
public TestView() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(246, 93);
this.setLayout(new BorderLayout());
this.add(getPnlThongtin(), BorderLayout.CENTER);
this.add(getPnlButton(), BorderLayout.SOUTH);
}
/**
* This method initializes pnlThongtin
*
* @return javax.swing.JPanel
*/
private JPanel getPnlThongtin() {
if (pnlThongtin == null) {
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints3.gridy = 1;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.insets = new Insets(5, 20, 5, 5);
gridBagConstraints3.gridx = 1;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.gridy = 0;
gridBagConstraints2.weightx = 1.0;
gridBagConstraints2.insets = new Insets(5, 20, 0, 5);
gridBagConstraints2.gridx = 1;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.insets = new Insets(5, 5, 5, 0);
gridBagConstraints1.gridy = 1;
lblPassword = new JLabel();
lblPassword.setText("Mất khẩu");
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = GridBagConstraints.WEST;
gridBagConstraints.insets = new Insets(5, 5, 0, 0);
gridBagConstraints.gridy = 0;
lblUser = new JLabel();
lblUser.setText("Tên ngư�i dùng");
pnlThongtin = new JPanel();
pnlThongtin.setLayout(new GridBagLayout());
pnlThongtin.add(lblUser, gridBagConstraints);
pnlThongtin.add(lblPassword, gridBagConstraints1);
pnlThongtin.add(getTxtUser(), gridBagConstraints2);
pnlThongtin.add(getTxtPassword(), gridBagConstraints3);
}
return pnlThongtin;
}
/**
* This method initializes pnlButton
*
* @return javax.swing.JPanel
*/
private JPanel getPnlButton() {
if (pnlButton == null) {
FlowLayout flowLayout = new FlowLayout();
flowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
pnlButton = new JPanel();
pnlButton.setLayout(flowLayout);
pnlButton.add(getBtDangnhap(), null);
pnlButton.add(getBtThoat(), null);
}
return pnlButton;
}
/**
* This method initializes btDangnhap
*
* @return javax.swing.JButton
*/
private JButton getBtDangnhap() {
if (btDangnhap == null) {
btDangnhap = new JButton();
btDangnhap.setText("Ä�ăng nháºp");
}
return btDangnhap;
}
/**
* This method initializes btThoat
*
* @return javax.swing.JButton
*/
private JButton getBtThoat() {
if (btThoat == null) {
btThoat = new JButton();
btThoat.setText("Thoát");
}
return btThoat;
}
/**
* This method initializes txtUser
*
* @return javax.swing.JTextField
*/
private JTextField getTxtUser() {
if (txtUser == null) {
txtUser = new JTextField();
}
return txtUser;
}
/**
* This method initializes txtPassword
*
* @return javax.swing.JPasswordField
*/
private JPasswordField getTxtPassword() {
if (txtPassword == null) {
txtPassword = new JPasswordField();
}
return txtPassword;
}
public void doThoat(ActionListener action) {
this.btThoat.addActionListener(action);
}
public void doDangnhap(ActionListener action) {
this.btDangnhap.addActionListener(action);
}
} // @jve:decl-index=0:visual-constraint="10,10"
---------------------------------------------------------------------------------------------------------------------------------
package org.hvbk.util;
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
public static Date getDate(int ngay, int thang, int nam) {
Calendar cal = Calendar.getInstance();
cal.set(nam, thang - 1, ngay);
return cal.getTime();
}
public static String dateToString(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
// 'DD/MM/YYY'
return String.valueOf(cal.get(Calendar.DATE)) + "/"
+ String.valueOf(cal.get(Calendar.MONTH) + 1) + "/"
+ String.valueOf(cal.get(Calendar.YEAR));
}
}
---------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
Bạn đang đọc truyện trên: Truyen247.Pro