Capture video in OPENCV

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: stopflag = 1; System.loadLibrary(“opencv_java300”); vc = new VideoCapture(0); Thread t = new Thread(){ @Override public void run() { while (true) { if (vc.isOpened()) { Mat m = new Mat(); vc.read(m); ImageIcon i = new ImageIcon(Mat2bufferedImage(m)); jLabel3.setIcon(i); jLabel3.repaint(); if (stopflag == 0) { vc.release();