List of usage examples for java.awt Canvas setSize
public void setSize(Dimension d)
From source file:biometricgui.MainWindow.java
void runMedia(String filePath) { NativeDiscovery nd = new NativeDiscovery(); if (!nd.discover()) { System.out.println("VLC not found"); System.exit(-1);// www . j a v a 2s . co m } Canvas canvas = new Canvas(); jPanel1.add(canvas); canvas.setSize(jPanel1.getSize()); jPanel1.revalidate(); jPanel1.repaint(); MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(); EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer(); CanvasVideoSurface videoSurface = mediaPlayerFactory.newVideoSurface(canvas); mediaPlayer.setVideoSurface(videoSurface); jLabel2.setVisible(false); mediaPlayer.playMedia(filePath); }