Langsung aja bro ne Sourcodenya
public class FormLogin extends javax.swing.JFrame {
public static String a;
/** Creates new form FormLogin */
public FormLogin() {
initComponents();
password.setText("");
txtNama.requestFocus();
setLocationRelativeTo(this);
}
private void tmblMasukActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String nama,pass;
nama=txtNama.getText();
pass=password.getToolTipText();
if(txtNama.getText().equals("karyawan")&&password.getText().equals("karyawan")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else
if(txtNama.getText().equals("admin")&&password.getText().equals("admin")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else{
JOptionPane.showMessageDialog(this, "Sory,,Login gagal bro");
}
}
private void txtNamaKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if(evt.getKeyChar()==10){
password.requestFocus();
}
}
private void tmblBatalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
private void passwordKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyChar()==10){
String nama,pass;
nama=txtNama.getText();
pass=password.getToolTipText();
if(txtNama.getText().equals("karyawan")&&password.getText().equals("karyawan")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else
if(txtNama.getText().equals("admin")&&password.getText().equals("admin")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else{
JOptionPane.showMessageDialog(this, "Sory,,Login gagal bro");
txtNama.setText("");
password.setText("");
txtNama.requestFocus();
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FormLogin().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel lblLogin;
private javax.swing.JLabel lblNama;
private javax.swing.JLabel lblPassword;
private javax.swing.JPanel panel1;
private javax.swing.JPasswordField password;
private javax.swing.JButton tmblBatal;
private javax.swing.JButton tmblMasuk;
private javax.swing.JTextField txtNama;
// End of variables declaration
}
Hasil Outputnya :
public class FormLogin extends javax.swing.JFrame {
public static String a;
/** Creates new form FormLogin */
public FormLogin() {
initComponents();
password.setText("");
txtNama.requestFocus();
setLocationRelativeTo(this);
}
private void tmblMasukActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String nama,pass;
nama=txtNama.getText();
pass=password.getToolTipText();
if(txtNama.getText().equals("karyawan")&&password.getText().equals("karyawan")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else
if(txtNama.getText().equals("admin")&&password.getText().equals("admin")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else{
JOptionPane.showMessageDialog(this, "Sory,,Login gagal bro");
}
}
private void txtNamaKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if(evt.getKeyChar()==10){
password.requestFocus();
}
}
private void tmblBatalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
private void passwordKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
if (evt.getKeyChar()==10){
String nama,pass;
nama=txtNama.getText();
pass=password.getToolTipText();
if(txtNama.getText().equals("karyawan")&&password.getText().equals("karyawan")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else
if(txtNama.getText().equals("admin")&&password.getText().equals("admin")){
a=txtNama.getText();
new Transaksi().show();
this.dispose();
}else{
JOptionPane.showMessageDialog(this, "Sory,,Login gagal bro");
txtNama.setText("");
password.setText("");
txtNama.requestFocus();
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FormLogin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FormLogin().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel lblLogin;
private javax.swing.JLabel lblNama;
private javax.swing.JLabel lblPassword;
private javax.swing.JPanel panel1;
private javax.swing.JPasswordField password;
private javax.swing.JButton tmblBatal;
private javax.swing.JButton tmblMasuk;
private javax.swing.JTextField txtNama;
// End of variables declaration
}
Hasil Outputnya :
1. Silahkan masukkan komentar
2. Berkomentar dengan kata-kata yang santun
3. Jangan menggunakan kata-kata kotor
4. Jika anda tidak suka dengan yang kami sajikan, lebih baik jangan di baca
5. Tinggalkan link web/blog anda agar admin bisa visit back
6. Jadilah pengunjung yang baik
7. Kami hanya memberikan informasi dari sumber-sumber yang bisa admin percaya.
8. Maaf jika ada salah satu artikel tidak ada sumbernya.
EmoticonEmoticon