private void ubahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ubahActionPerformed
        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="UPDATE `restaurant`.`makanan` SET "
                                + "`kategori` = '"+kategori.getSelectedIndex()+"', "
                                + "`harga` = '"+harga.getText()+"' "
                          + "WHERE `makanan`.`nama` = '"+nama.getText()+"'";
            st.executeUpdate(strSQL);

            int row = tblmakanan.convertRowIndexToModel(tblmakanan.getSelectedRow());
            tblModel.removeRow(row);
            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());
        }  
    }//GEN-LAST:event_ubahActionPerformed