(+84) 236.3827111 ex. 402

GUI đăng nhập trong Java và nút Thoát (có thông báo Yes/No)


private void btn_LoginActionPerformed(java.awt.event.ActionEvent evt) {

if(txt_TenDN.getText().equals("dtu") && txt_MatKhau.getText().equals("123")){

GUI_NV nv = new GUI_NV();

nv.setVisible(true);

}else JOptionPane.showMessageDialog(null,"Sai tên DN hoặc MK");

}

private void btn_thoatActionPerformed(java.awt.event.ActionEvent evt) {

int thoat = JOptionPane.showConfirmDialog(null,

"Bạn có muốn thoát không", "Thông báo",

JOptionPane.YES_NO_OPTION);

if(thoat == 0)

//System.exit(0);

this.dispose();

}

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Login().setVisible(true);

}

});

}