There is no imshow in the java, you need to write a method for this. This method is a Mat2bufferedImage. Takes mat object as parameter and returns image.
public static void main(String[] args) {
Mat frame = new Mat();
//0; default video device id
VideoCapture camera = new VideoCapture(0);
JFrame jframe = new JFrame("Title");
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel vidpanel = new JLabel();
jframe.setContentPane(vidpanel);
jframe.setVisible(true);
while (true) {
if (camera.read(frame)) {
ImageIcon image = new ImageIcon(Mat2bufferedImage(frame));
vidpanel.setIcon(image);
vidpanel.repaint();
}
}
}