Aplikasi Pembukuan Arisan Menggunakan Java


Arisan adalah kelompok orang yang mengumpulkan uang secara teratur pada tiap-tiap periode tertentu. Setelah uang terkumpul, salah satu dari anggota kelompok akan keluar sebagai pemenang. Penentuan pemenang biasanya dilakukan dengan jalan pengundian, namun ada juga kelompok arisan yang menentukan pemenang dengan perjanjian. (Sumber Wikipedia).

Biasanya panitia arisan melakukan pencatatan atau pembukuan ketika ada anggota yang mendapat arisan. Pembukuan dilakukan kebanyakan masih dengan cara manual yaitu dicatat didalam buku.
Di era digital saat ini mungkin cara sperti itu sudah terbilang kuno, namun masih sangat efektif dan tetap banyak digunakan.
Pada studi kasus tersebut saya mencoba membuat sebuah program / aplikasi desktop sederhana menggunakan bahasa pemrograman java yang penyimpanan datanya menggunakan database MySQL. Saya akan share source code aplikasi pembukuan arisan ini barang kali berguna buat sobat untuk dipelajari dan dikembangkan lagi.

Mari simak turorial untuk membuat aplikasi pembukuan arisan di bawah ini:


  1. Buat database terlebih dahulu, nama databasenya db_arisan dengan tabel anggota dan tabel login.

  2. Selanjutnya buka aplikasi IDE, disini saya menggunakan IDE NetBeans 8.2
  3. Buat class JFrame dengan nama login.java dan desain tampilannya seperti berikut:


  4. Source code login.java:
    import java.sql.*;
    import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;
    
    public class login extends javax.swing.JFrame {
        public arisan arisan;
        public Connection con;
        public Statement stt;
       
        public login() {
            initComponents();
            this.setIconImage(new ImageIcon(getClass().getResource("icon APA.png")).getImage());
            try {
                Class.forName("com.mysql.jdbc.Driver");
                con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_arisan","root","");
                stt = con.createStatement();
                System.out.println("Koneksi Berhasil");
            } catch (Exception e) {
                System.out.println("Koneksi Gagal");
            }
        }
    
      
        @SuppressWarnings("unchecked")
        //                           
        private void initComponents() {
    
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            txtUsername = new javax.swing.JTextField();
            txtPassword = new javax.swing.JPasswordField();
            btnLogin = new javax.swing.JButton();
            bgadmin = new javax.swing.JLabel();
            formLogin = new javax.swing.JLabel();
            apa = new javax.swing.JLabel();
            bgLogin = new javax.swing.JLabel();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("APA - Aplikasi Pembukuan Arisan - V.1.0 Beta");
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    
            jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jLabel2.setText("Username");
            getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 160, -1, 20));
    
            jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jLabel3.setText("Password");
            getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 200, -1, 20));
            getContentPane().add(txtUsername, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 160, 160, -1));
            getContentPane().add(txtPassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(540, 200, 160, -1));
    
            btnLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lock.png"))); // NOI18N
            btnLogin.setText("Login");
            btnLogin.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnLoginActionPerformed(evt);
                }
            });
            getContentPane().add(btnLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 240, 90, -1));
    
            bgadmin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/admin.png"))); // NOI18N
            getContentPane().add(bgadmin, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 150, 74, 88));
    
            formLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/form login.png"))); // NOI18N
            getContentPane().add(formLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 90, -1, 200));
    
            apa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/apa.png"))); // NOI18N
            getContentPane().add(apa, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 140, 240, 100));
    
            bgLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg.png"))); // NOI18N
            getContentPane().add(bgLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 800, 400));
    
            pack();
            setLocationRelativeTo(null);
        }//                         
    
        private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {                                         
           
            try {
                String sql = "Select * From login Where username = '"+txtUsername.getText()+"' and password = '"+String.valueOf(txtPassword.getPassword()) +"'";
                ResultSet rss = stt.executeQuery(sql);
                if (rss.next()){
                    arisan = new arisan();
                    arisan.setVisible(true);
                    this.dispose();             
                }
                else {
                    JOptionPane.showMessageDialog(null, "Gagal Login");
                }
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "Salah prosedur");
            }
            
        }                                        
    
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
           
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new login().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JLabel apa;
        private javax.swing.JLabel bgLogin;
        private javax.swing.JLabel bgadmin;
        private javax.swing.JButton btnLogin;
        private javax.swing.JLabel formLogin;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JPasswordField txtPassword;
        private javax.swing.JTextField txtUsername;
        // End of variables declaration                   
    }
    
    
  5. Buat class JFrame arisan.java dan desain tampilan seperti berikut:

  6. Source code arisan.java:
    import java.sql.*;
    import javax.swing.ImageIcon;
    
    import koneksi.koneksi;
    
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    
    public class arisan extends javax.swing.JFrame {
    
        koneksi con;
        private Object [][]tbl_input = null;
        private String []label = {"No.Peserta", "Nama", "Alamat", "No. HP", "Status Arisan", "Tanggal Dapat"};
        
        public arisan() {
            initComponents();
            
            this.setIconImage(new ImageIcon(getClass().getResource("icon.png")).getImage());
            con = new koneksi();
            con.Class();
            BacaTabel();
        }
    
      
         
         private void BacaTabel(){
            try {
                con.ss = (Statement) con.cc.createStatement();
                String sql = "Select * From anggota Order By no_peserta";
                con.rr = con.ss.executeQuery(sql);
                ResultSetMetaData m = con.rr.getMetaData();
                int kolom = m.getColumnCount();
                int baris = 0;
                while (con.rr.next()){
                    baris = con.rr.getRow();
                }
                tbl_input = new Object[baris][kolom];
                int x = 0;
                con.rr.beforeFirst();            
                while (con.rr.next()){
                    tbl_input [x][0] = con.rr.getString("no_peserta");
                    tbl_input [x][1] = con.rr.getString("nama");
                    tbl_input [x][2] = con.rr.getString("alamat");
                    tbl_input [x][3] = con.rr.getString("no_hp");
                    tbl_input [x][4] = con.rr.getString("status_arisan");
                    tbl_input [x][5] = con.rr.getString("tanggal_dapat");
                    x++;
                }
                  tabelAnggota.setModel(new DefaultTableModel(tbl_input, label));                    
            } catch (SQLException e) {    
                JOptionPane.showMessageDialog(null, e);
            }
        }
       
         private void setTabel(){
            int row = tabelAnggota.getSelectedRow();
            txtNoPeserta.setText((String)tabelAnggota.getValueAt(row, 0));
            txtNama.setText((String)tabelAnggota.getValueAt(row, 1));
            txtAlamat.setText((String)tabelAnggota.getValueAt(row, 2));
            txtNoHP.setText((String)tabelAnggota.getValueAt(row, 3));
            comboStatusArisan.setSelectedItem((String)tabelAnggota.getValueAt(row, 4));
            txtTanggalDapat.setText((String)tabelAnggota.getValueAt(row, 5));
        }
        
          private void input(){
            String no_peserta = this.txtNoPeserta.getText();
            String nama = this.txtNama.getText();
            String alamat = this.txtAlamat.getText();
            String no_hp = this.txtNoHP.getText();        
            String status_arisan = (String) this. comboStatusArisan.getSelectedItem();        
            String tanggal_dapat = this.txtTanggalDapat.getText(); 
            
            try {
              String sql= "Insert into anggota values (?,?,?,?,?,?)";
              PreparedStatement p = (PreparedStatement) con.cc.prepareStatement(sql);
                p.setString(1, no_peserta);
                p.setString(2, nama);
                p.setString(3, alamat);
                p.setString(4, no_hp);
                p.setString(5, status_arisan);
                p.setString(6, tanggal_dapat);
               
                p.executeUpdate();
                
                BacaTabel();
                JOptionPane.showMessageDialog(this, "Data sukses di input");
                            
            }catch (SQLException e){
                System.out.println(e);
            }
        }
        
        private void update(){
            String no_peserta = this.txtNoPeserta.getText();
            String nama = this.txtNama.getText();
            String alamat = this.txtAlamat.getText();
            String no_hp = this.txtNoHP.getText();        
            String status_arisan = (String) this.comboStatusArisan.getSelectedItem();
            String tanggal_dapat = this.txtTanggalDapat.getText();
           
            
            try {
              String sql= "Update anggota Set nama=?, alamat=?, no_hp=?, status_arisan=?, tanggal_dapat=? Where no_peserta=?";
              PreparedStatement p = (PreparedStatement) con.cc.prepareStatement(sql);
                p.setString(6, no_peserta);
                p.setString(1, nama);
                p.setString(2, alamat);
                p.setString(3, no_hp);
                p.setString(4, status_arisan);
                p.setString(5, tanggal_dapat);
                p.executeUpdate();
                
                BacaTabel();
                JOptionPane.showMessageDialog(this, "Data sukses di update");
                            
            }catch (SQLException e){
                System.out.println(e);
            }
        }
        
        private void delete(){
            try {
                String sql = "Delete From anggota Where no_peserta = '"+txtNoPeserta.getText()+"'";
                con.ss.executeUpdate(sql);
                con.ss.close();
                JOptionPane.showMessageDialog(null, " Data berhasil dihapus");
                BacaTabel();
                txtNoPeserta.requestFocus();
                           
            } catch (SQLException e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
       
        private  void refresh (){
            txtNoPeserta.setText("");
            txtNama.setText("");
            txtAlamat.setText("");
            txtNoHP.setText("");
            comboStatusArisan.setSelectedItem(null);
            txtTanggalDapat.setText("");       
                   
        }
        
        
        @SuppressWarnings("unchecked")
        //                           
        private void initComponents() {
    
            NoPeserta = new javax.swing.JLabel();
            Nama = new javax.swing.JLabel();
            NoHP = new javax.swing.JLabel();
            Alamat = new javax.swing.JLabel();
            StatusArisan = new javax.swing.JLabel();
            TanggalDapat = new javax.swing.JLabel();
            txtNoPeserta = new javax.swing.JTextField();
            txtNama = new javax.swing.JTextField();
            txtNoHP = new javax.swing.JTextField();
            jScrollPane = new javax.swing.JScrollPane();
            txtAlamat = new javax.swing.JTextArea();
            comboStatusArisan = new javax.swing.JComboBox();
            jScrollPane1 = new javax.swing.JScrollPane();
            tabelAnggota = new javax.swing.JTable();
            btnResfresh = new javax.swing.JButton();
            btnInput = new javax.swing.JButton();
            btnUpdate = new javax.swing.JButton();
            btnDelete = new javax.swing.JButton();
            txtTanggalDapat = new javax.swing.JTextField();
            bgLabel = new javax.swing.JLabel();
            jMenuBar1 = new javax.swing.JMenuBar();
            anggota = new javax.swing.JMenu();
            SatusArisan = new javax.swing.JMenu();
            SudahDapat = new javax.swing.JMenuItem();
            BelumDapat = new javax.swing.JMenuItem();
            about = new javax.swing.JMenu();
            keluar = new javax.swing.JMenu();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("APA - Aplikasi Pembukuan Arisan - V.1.0 - Beta");
            getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    
            NoPeserta.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            NoPeserta.setForeground(new java.awt.Color(255, 255, 255));
            NoPeserta.setText("No. Peserta");
            getContentPane().add(NoPeserta, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, -1, -1));
    
            Nama.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            Nama.setForeground(new java.awt.Color(255, 255, 255));
            Nama.setText("Nama");
            getContentPane().add(Nama, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 70, -1, -1));
    
            NoHP.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            NoHP.setForeground(new java.awt.Color(255, 255, 255));
            NoHP.setText("No. HP");
            getContentPane().add(NoHP, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 200, -1, -1));
    
            Alamat.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            Alamat.setForeground(new java.awt.Color(255, 255, 255));
            Alamat.setText("Alamat");
            getContentPane().add(Alamat, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, -1, -1));
    
            StatusArisan.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            StatusArisan.setForeground(new java.awt.Color(255, 255, 255));
            StatusArisan.setText("Status Arisan");
            getContentPane().add(StatusArisan, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 240, -1, -1));
    
            TanggalDapat.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
            TanggalDapat.setForeground(new java.awt.Color(255, 255, 255));
            TanggalDapat.setText("Tanggal Dapat");
            getContentPane().add(TanggalDapat, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 280, -1, -1));
            getContentPane().add(txtNoPeserta, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 30, 100, -1));
            getContentPane().add(txtNama, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 70, 220, -1));
            getContentPane().add(txtNoHP, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 200, 150, -1));
    
            txtAlamat.setColumns(20);
            txtAlamat.setRows(5);
            jScrollPane.setViewportView(txtAlamat);
    
            getContentPane().add(jScrollPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 110, 220, 70));
    
            comboStatusArisan.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Sudah", "Belum" }));
            getContentPane().add(comboStatusArisan, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 240, -1, -1));
    
            tabelAnggota.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                },
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
                }
            ));
            tabelAnggota.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    tabelAnggotaMouseClicked(evt);
                }
            });
            jScrollPane1.setViewportView(tabelAnggota);
    
            getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 30, 390, 280));
    
            btnResfresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/refresh.png"))); // NOI18N
            btnResfresh.setText("Refresh");
            btnResfresh.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnResfreshActionPerformed(evt);
                }
            });
            getContentPane().add(btnResfresh, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 320, 110, -1));
    
            btnInput.setIcon(new javax.swing.ImageIcon(getClass().getResource("/input.png"))); // NOI18N
            btnInput.setText("Input");
            btnInput.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnInputActionPerformed(evt);
                }
            });
            getContentPane().add(btnInput, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 320, 110, -1));
    
            btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/update.png"))); // NOI18N
            btnUpdate.setText("Update");
            btnUpdate.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnUpdateActionPerformed(evt);
                }
            });
            getContentPane().add(btnUpdate, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 320, 110, -1));
    
            btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/delete.png"))); // NOI18N
            btnDelete.setText("Delete");
            btnDelete.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnDeleteActionPerformed(evt);
                }
            });
            getContentPane().add(btnDelete, new org.netbeans.lib.awtextra.AbsoluteConstraints(680, 320, 100, -1));
            getContentPane().add(txtTanggalDapat, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 280, 110, -1));
    
            bgLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bg.png"))); // NOI18N
            getContentPane().add(bgLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 800, 390));
    
            anggota.setIcon(new javax.swing.ImageIcon(getClass().getResource("/anggota.png"))); // NOI18N
            anggota.setText("Anggota");
            anggota.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    anggotaMouseClicked(evt);
                }
            });
            anggota.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    anggotaActionPerformed(evt);
                }
            });
            jMenuBar1.add(anggota);
    
            SatusArisan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/status arisan.png"))); // NOI18N
            SatusArisan.setText("Status Arisan");
    
            SudahDapat.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
            SudahDapat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sudah dapat.png"))); // NOI18N
            SudahDapat.setText("Sudah Dapat");
            SudahDapat.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    SudahDapatActionPerformed(evt);
                }
            });
            SatusArisan.add(SudahDapat);
    
            BelumDapat.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
            BelumDapat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/belum dapat.png"))); // NOI18N
            BelumDapat.setText("Belum Dapat");
            BelumDapat.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    BelumDapatActionPerformed(evt);
                }
            });
            SatusArisan.add(BelumDapat);
    
            jMenuBar1.add(SatusArisan);
    
            about.setIcon(new javax.swing.ImageIcon(getClass().getResource("/about.png"))); // NOI18N
            about.setText("About");
            about.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    aboutMouseClicked(evt);
                }
            });
            jMenuBar1.add(about);
    
            keluar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/keluar.png"))); // NOI18N
            keluar.setText("Keluar");
            keluar.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    keluarMouseClicked(evt);
                }
            });
            keluar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    keluarActionPerformed(evt);
                }
            });
            jMenuBar1.add(keluar);
    
            setJMenuBar(jMenuBar1);
    
            pack();
            setLocationRelativeTo(null);
        }//                         
    
        private void SudahDapatActionPerformed(java.awt.event.ActionEvent evt) {                                           
           
        new sudah().setVisible(true);
            
        }                                          
    
        private void btnResfreshActionPerformed(java.awt.event.ActionEvent evt) {                                            
             refresh();
        }                                           
    
        private void btnInputActionPerformed(java.awt.event.ActionEvent evt) {                                         
            input();
        }                                        
    
        private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {                                          
            update();
        }                                         
    
        private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {                                          
            delete();
        }                                         
    
        private void tabelAnggotaMouseClicked(java.awt.event.MouseEvent evt) {                                          
          setTabel();
        }                                         
    
        private void anggotaActionPerformed(java.awt.event.ActionEvent evt) {                                        
           
        }                                       
    
        private void keluarActionPerformed(java.awt.event.ActionEvent evt) {                                       
        
        }                                      
    
        private void aboutMouseClicked(java.awt.event.MouseEvent evt) {                                   
            new about().setVisible(true);
        }                                  
    
        private void anggotaMouseClicked(java.awt.event.MouseEvent evt) {                                     
            
        }                                    
    
        private void keluarMouseClicked(java.awt.event.MouseEvent evt) {                                    
           int a;
    a=JOptionPane.showConfirmDialog(null, "Yakin mau keluar.?", "Keluar", JOptionPane. YES_NO_OPTION);
    if(a==JOptionPane.YES_OPTION)
    {System.exit(0);}
    else
    {return;}
        }                                   
    
        private void BelumDapatActionPerformed(java.awt.event.ActionEvent evt) {                                           
            new belum().setVisible(true);
        }                                          
    
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new arisan().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JLabel Alamat;
        private javax.swing.JMenuItem BelumDapat;
        private javax.swing.JLabel Nama;
        private javax.swing.JLabel NoHP;
        private javax.swing.JLabel NoPeserta;
        private javax.swing.JMenu SatusArisan;
        private javax.swing.JLabel StatusArisan;
        private javax.swing.JMenuItem SudahDapat;
        private javax.swing.JLabel TanggalDapat;
        private javax.swing.JMenu about;
        private javax.swing.JMenu anggota;
        private javax.swing.JLabel bgLabel;
        private javax.swing.JButton btnDelete;
        private javax.swing.JButton btnInput;
        private javax.swing.JButton btnResfresh;
        private javax.swing.JButton btnUpdate;
        private javax.swing.JComboBox comboStatusArisan;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JScrollPane jScrollPane;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JMenu keluar;
        private javax.swing.JTable tabelAnggota;
        private javax.swing.JTextArea txtAlamat;
        private javax.swing.JTextField txtNama;
        private javax.swing.JTextField txtNoHP;
        private javax.swing.JTextField txtNoPeserta;
        private javax.swing.JTextField txtTanggalDapat;
        // End of variables declaration                   
    }
    
  7. Buat class Jframe sudah.java dan desain tampilan seperti berikut:

  8. Source code sudah.java:
    import java.sql.*;
    import javax.swing.ImageIcon;
    import koneksi.koneksi;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    import java.text.*;
    import java.awt.print.*;
    import javax.swing.JTable;
    
    
    public class sudah extends javax.swing.JFrame {
    
        koneksi con;
        private Object [][]tbl_input = null;
        private String []label = {"No.Peserta", "Nama", "Alamat", "No. HP", "Status Arisan", "Tanggal Dapat"};
        
        public sudah() {
            initComponents();
            this.setIconImage(new ImageIcon(getClass().getResource("sudah dapat.png")).getImage());
            con = new koneksi();
            con.Class();
            BacaTabel();
        }
    
         private void BacaTabel(){
            try {
                con.ss = (Statement) con.cc.createStatement();
                String sql = "Select * From anggota Where status_arisan='Sudah'";
                con.rr = con.ss.executeQuery(sql);
                ResultSetMetaData m = con.rr.getMetaData();
                int kolom = m.getColumnCount();
                int baris = 0;
                while (con.rr.next()){
                    baris = con.rr.getRow();
                }
                tbl_input = new Object[baris][kolom];
                int x = 0;
                con.rr.beforeFirst();            
                while (con.rr.next()){
                    tbl_input [x][0] = con.rr.getString("no_peserta");
                    tbl_input [x][1] = con.rr.getString("nama");
                    tbl_input [x][2] = con.rr.getString("alamat");
                    tbl_input [x][3] = con.rr.getString("no_hp");
                    tbl_input [x][4] = con.rr.getString("status_arisan");
                    tbl_input [x][5] = con.rr.getString("tanggal_dapat");
                    x++;
                }
                  tabelSudah.setModel(new DefaultTableModel(tbl_input, label));                    
            } catch (SQLException e) {    
                JOptionPane.showMessageDialog(null, e);
            }
        }
       
       
        @SuppressWarnings("unchecked")
        //                           
        private void initComponents() {
    
            jScrollPane1 = new javax.swing.JScrollPane();
            tabelSudah = new javax.swing.JTable();
            jLabel1 = new javax.swing.JLabel();
            btnCetak = new javax.swing.JButton();
            btnKeluar = new javax.swing.JButton();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("DAFTAR PESERTA YANG SUDAH DAPAT ARISAN ");
    
            tabelSudah.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                },
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
                }
            ));
            jScrollPane1.setViewportView(tabelSudah);
    
            jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jLabel1.setText("DAFTAR PESERTA YANG SUDAH DAPAT ARISAN ");
    
            btnCetak.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cetak.png"))); // NOI18N
            btnCetak.setText("Cetak");
            btnCetak.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnCetakActionPerformed(evt);
                }
            });
    
            btnKeluar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/keluar.png"))); // NOI18N
            btnKeluar.setText("Keluar");
            btnKeluar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnKeluarActionPerformed(evt);
                }
            });
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jScrollPane1)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnCetak)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnKeluar)))
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(btnKeluar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(btnCetak)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            );
    
            pack();
            setLocationRelativeTo(null);
        }//                         
    
        private void btnKeluarActionPerformed(java.awt.event.ActionEvent evt) {                                          
            dispose();
        }                                         
    
        private void btnCetakActionPerformed(java.awt.event.ActionEvent evt) {                                         
          
            MessageFormat header = new MessageFormat("Laporan Pembukuan Arisan Yang Sudah Dapat");
            MessageFormat footer = new MessageFormat("Halaman {0, number, integer}");
            
            try {
                tabelSudah.print(JTable.PrintMode.NORMAL, header, footer);
                
            } catch (java.awt.print.PrinterException e) {
                System.err.format("Cannot print %s%n", e.getMessage());
            }
            
        }                                        
    
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //
            /* 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(sudah.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(sudah.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(sudah.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(sudah.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new sudah().setVisible(true);
                    
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JButton btnCetak;
        private javax.swing.JButton btnKeluar;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTable tabelSudah;
        // End of variables declaration                   
    }
    
  9. Buat class belum.java dan desain tampilan seperti berikut:


  10. Source code belum.java:
    import java.sql.*;
    import javax.swing.ImageIcon;
    import koneksi.koneksi;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    import java.text.*;
    import java.awt.print.*;
    import javax.swing.JTable;
    
    
    public class belum extends javax.swing.JFrame {
    
        koneksi con;
        private Object [][]tbl_input = null;
        private String []label = {"No.Peserta", "Nama", "Alamat", "No. HP", "Status Arisan", "Tanggal Dapat"};
        
        public belum() {
            initComponents();
            this.setIconImage(new ImageIcon(getClass().getResource("belum dapat.png")).getImage());
            con = new koneksi();
            con.Class();
            BacaTabel();
        }
    
         private void BacaTabel(){
            try {
                con.ss = (Statement) con.cc.createStatement();
                String sql = "Select * From anggota Where status_arisan='Belum'";
                con.rr = con.ss.executeQuery(sql);
                ResultSetMetaData m = con.rr.getMetaData();
                int kolom = m.getColumnCount();
                int baris = 0;
                while (con.rr.next()){
                    baris = con.rr.getRow();
                }
                tbl_input = new Object[baris][kolom];
                int x = 0;
                con.rr.beforeFirst();            
                while (con.rr.next()){
                    tbl_input [x][0] = con.rr.getString("no_peserta");
                    tbl_input [x][1] = con.rr.getString("nama");
                    tbl_input [x][2] = con.rr.getString("alamat");
                    tbl_input [x][3] = con.rr.getString("no_hp");
                    tbl_input [x][4] = con.rr.getString("status_arisan");
                    tbl_input [x][5] = con.rr.getString("tanggal_dapat");
                    x++;
                }
                  tabelBelum.setModel(new DefaultTableModel(tbl_input, label));                    
            } catch (SQLException e) {    
                JOptionPane.showMessageDialog(null, e);
            }
        }
        @SuppressWarnings("unchecked")
        //                           
        private void initComponents() {
    
            jScrollPane1 = new javax.swing.JScrollPane();
            tabelBelum = new javax.swing.JTable();
            jLabel1 = new javax.swing.JLabel();
            btnCetak = new javax.swing.JButton();
            btnKeluar = new javax.swing.JButton();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setTitle("DAFTAR PESERTA YANG BELUM DAPAT ARISAN ");
    
            tabelBelum.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                },
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
                }
            ));
            jScrollPane1.setViewportView(tabelBelum);
    
            jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jLabel1.setText("DAFTAR PESERTA YANG BELUM DAPAT ARISAN ");
    
            btnCetak.setIcon(new javax.swing.ImageIcon(getClass().getResource("/cetak.png"))); // NOI18N
            btnCetak.setText("Cetak");
            btnCetak.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnCetakActionPerformed(evt);
                }
            });
    
            btnKeluar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/keluar.png"))); // NOI18N
            btnKeluar.setText("Keluar");
            btnKeluar.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnKeluarActionPerformed(evt);
                }
            });
    
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane1)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnCetak)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(btnKeluar)))
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addGap(12, 12, 12)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(btnKeluar)
                        .addComponent(btnCetak))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
    
            pack();
            setLocationRelativeTo(null);
        }//                         
    
        private void btnKeluarActionPerformed(java.awt.event.ActionEvent evt) {                                          
           dispose();
        }                                         
    
        private void btnCetakActionPerformed(java.awt.event.ActionEvent evt) {                                         
           
            MessageFormat header = new MessageFormat("Laporan Pembukuan Arisan Yang Belum Dapat");
            MessageFormat footer = new MessageFormat("Halaman {0, number, integer}");
            
            try {
                tabelBelum.print(JTable.PrintMode.NORMAL, header, footer);
                
            } catch (java.awt.print.PrinterException e) {
                System.err.format("Cannot print %s%n", e.getMessage());
            }
        }                                        
    
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //
            /* 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(belum.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(belum.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(belum.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(belum.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new belum().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JButton btnCetak;
        private javax.swing.JButton btnKeluar;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTable tabelBelum;
        // End of variables declaration                   
    }
    
    
  11. Jika sudah jalankan projectnya, klik run file pada login.java, dan berikut hasilnya:

  12. Selesai :- ) Semoga bermanfaant, jangan lupa bersyukur dan dishare.
  13. Download project diatas pada link di bawah ini:




Keywords:
  • aplikasi pembukuan arisan menggunakan java
  • download aplikasi pembukuan arisan menggunakan java
  • download source code aplikasi pembukuan arisan menggunakan java
  • aplikasi pembukuan arisan menggunakan java netbeans
  • aplikasi pembukuan arisan menggunakan java dan mysql
  • cara membuat aplikasi pembukuan arisan menggunakan java
  • cara membuat database arisan
  • database arisan
  • matakuliah pbo
  • oop
  • java netbeans
  • project tugas besar
  • download aplikasi arisan
  • crud java
  • tutorial membuat aplikasi pembukuan arisan menggunakan java
  • free download aplikasi pembukuan arisan menggunakan java
  • arisan java
  • program pembukuan arisan
  • program arisan
  • download program untuk arisan
  • contoh database arisan
  • contoh aplikasi arisan

0 Response to "Aplikasi Pembukuan Arisan Menggunakan Java"

Posting Komentar