Skip to main content

Source code program makes Login system with Netbeans

Source code program makes Login system with Netbeans

Login system makes the keypad / button that can not access / click can be activated and can be accessed / click .
1.      Design main display form as in the picture below

#Sub menu Login will be changed automatically be Logout when Login was successful.
#all key / button is not active ( enabled = false ) .
 
2.      Create a database ( I'm using MySQL ) , following the example of the database structure to table his admin

3.      Do not forget Add Library MySQL JDBC drivers , how to stay right-click on Libraries > Select the Add Library to display the following

4.      If the MySQL JDBC Driver has not any , click the Import button and locate the file its MySQL JDBC Driver and then select the file and press Ok .After successfully import , select the file again its MySQL JDBC Driver and then click the Add Library
5.      For the system source code Login Login Button Right click > Events > Action > actionPerformed then type the following code
 
try {
            Connection koneksi=DriverManager.getConnection("jdbc:mysql://localhost:3306/medica","root","");
            Statement stat= koneksi.createStatement();
            ResultSet rs=stat.executeQuery("select count(id_admin) from admin where id_admin='"+jPasswordUser.getText()+"' and password='"+jPasswordPass.getText()+"'" );
            if(rs.next()){
                int id_admin=rs.getInt(1);
                if(id_admin>0){
                    TbObat.setEnabled(true);
                    TbTindakan.setEnabled(true);
                    TbDokter.setEnabled(true);
                    TbPasien.setEnabled(true);
                    TbPetugas.setEnabled(true);
                    Login.setText("Logout");       //merubah sub menu Login menjadi Logout
                    PanelLogin.setVisible(false);
                    jPasswordPass.setText("");
                    jPasswordUser.setText("");
                }else {
                    TbObat.setEnabled(false);
                    TbTindakan.setEnabled(false);
                    TbDokter.setEnabled(false);
                    TbPasien.setEnabled(false);
                    TbPetugas.setEnabled(false);
                    Login.setText("Login");
                    JOptionPane.showMessageDialog(null,"Maaf, Username atau Password SALAH,Silahkan ulangi Login...!");
                    jPasswordUser.setFocusable(true);
                    jPasswordPass.setText("");
                    jPasswordUser.setText("");
                }
            }
        } catch (SQLException ex) {
            System.out.println(ex);
        }
#Description: The name of the database , table , field , button , TextField , form Login adjust to have each of you .
 
6.      Later on also click the Right Button Cancel > Events > Action > actionPerformed then type the following code :
  jPasswordPass.setText("");
        jPasswordUser.setText("");
        PanelLogin.setVisible(false);
 
7.      Try the program in the Run and see the results !
- The initial view when the sub menu Log in clicks , all the key / button is not active as yet Login

- Display when Button click Login and Login successful , turned into a sub menu Login Logout automatic and all key / button is active

- Display as Username and Password are entered incorrectly , the textfield will return empty . When the Cancel button is clicked Login form will disappear

that interest project / source code please download
if you want e -book please download e-book

good luck and HAPPY CODING : D
 

Comments

Popular posts from this blog

Tutorial atau Cara Menambahkan Palette yang Belum Tersedia di Netbeans

Ini juga gak kalah mudahnya, tapi semoga bermanfaat karena berbagi itu gak ada yang sia-sia. (yang di praktekkan menambahkan palette jDateTimePicker. Berikut langkah-langkahnya : 1.      Pada menu bar Tools pilih Palette > pilih Swing/AWT Components. 2.        Setelah muncul tampilan seperti dibawah klik Add From Jar. 3.        Cari file Calendar.jar yang sudah anda download/simpan, jika belum punya silahkan temen2 download dulu di >> Download Kemudian klik Next. 4.        Pilih Available Components JDateTimePicker, Kemudian klik Next. 5.        Pilih palette categories tempat untuk menyimpan hasil penambahan palette jDateTimePicker nya, disini saya pilih Swing Controls Klik Finish. Form yang masih terbuka close saja.  6.        Cek di palette Swing Controls, jika berhasil maka palette jDateTimePicker akan muncul seperti pada gambar dibawah : 7.        Untuk peenggunaannya ya seperti palette yang lain, tinggal klik kemu

Contoh Normalisasi, Relasi Antar Tabel, Kamus Data dan Pembuatan Database Sistem Informasi Klinik atau Rumah Sakit

Assalamu'alaikum... Mencoba berbagi lagi sambil nunggu waktu buka puasa, irna pengen bahas tentang bagaimana merancang sistem (analisys system) pembuatan sebuah Sistem Informasi Klinik atau bisa juga Rumah Sakit tapi dalam lingkup kecil. Yang mau irna bahas disini dari pembuatan Normalisasi, Relasi Antar Tabel, Kamus Data dan Pembuatan Database Sistem Informasinya. Pembahasan sebelumnya tentang Contoh Analisis dan Perancangan Sistem Informasi Klinik atau Rumah Sakit (Diagram Konteks, DFD/DAD, Flowchart System) sudah irna posting lebih dulu kok tinggal klik aja link nya tapi jangan lupa Skip Add yah tunggu 5 detik ajah hehee... Yupzt berikut hasil screen shoot gambar-gambarnya untuk normalisasi sampai kamus data nya : >> Bentuk Tidak Normal (Unnormal) : >> Bentuk Normal Pertama : >> Bentuk Normal kedua : >> Bentuk Normal Ketiga : >> Relasi Antar Tabel : >> Kamus Data : Tabel 4. 1 Pengguna No Fie

Tutorial Membuat Penomoran Otomatis atau Auto Number Java Netbeans

Membuat penomoran otomatis atau auto number, Yaitu ketika form ditampilkan, selesai menyimpan data, edit data, hapus data dan membatalkan penginputan kode/id/nomor akan muncul secara otomatis dan urut melanjutkan kode yang sudah diinputkan. Berikut cara pembuatannya :       1. Tentunya buka dahulu project Anda masing-masing hehee… kemudian masuk ke Tab menu Project Anda dan buatlah Source Package baru dengan cara klik kanan Source Package pada projeck Anda> pilih New > pilih Java Package.. seperti pada gambar, Isikan Package Name sesuai keinginan Anda, kalau punya saya medical.classJava (medical = nama project) hehee… Klik Finish.       2.    Kemudian buatlah sebuah Java Class di dalam Source Package yang baru saja dibuat tadi. Caranya seperti biasa klik kanan > pilih New > pilih Java Class.. Setelah muncul form , berikan nama Validasi pada Class Namenya. Kemudian klik Finish.       3. Setelah muncul Validasi.java di bawah coding p