private void tambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahActionPerformed
        if (dataSudahAda(nama.getText()) == false){
            try{
                Class.forName ("com.mysql.jdbc.Driver");

                String urldb="jdbc:mysql://localhost:3306/restaurant";
                String user=main.dbUser;
                String password=main.dbPassword;
                Connection koneksi = java.sql.DriverManager.getConnection(urldb,user,password);
               
                Statement st = koneksi.createStatement();
                String strSQL = "INSERT INTO `restaurant`.`makanan` ( `nama` , `kategori` , `harga` ) "
                              + "VALUES ( '"+nama.getText()+"', '"+kategori.getSelectedIndex()+"', '"+harga.getText()+"');";
                st.executeUpdate(strSQL);
                
                String jenis;
                if (kategori.getSelectedIndex() == 0){
                    jenis = "Makanan";
                } else {
                    jenis = "Minuman";
                }
                
                tblModel.insertRow(0, new String[]{nama.getText(), jenis, harga.getText()});

                nama.setText("");
                kategori.setSelectedIndex(-1);
                harga.setText("");
                
                st.close();
                koneksi.close();
            }catch(ClassNotFoundException cnfe){
                System.out.println("KESALAHAN SAAT"+"ME-LOAD DRIVER JDBC \n"+cnfe.getMessage());
            }catch(SQLException sqle){
                System.out.println("KESALAHAN SAAT KONEKSI ATAU "+"KESALAHAN QUERY SQL \n"+sqle.getMessage());
            }
        } else {
            JOptionPane.showMessageDialog(null, "Nama pegawai sudah terdaftar!");
        }
    }//GEN-LAST:event_tambahActionPerformed