I am currently in the position of having 2 pieces of work I wish to combine. I have a simple media player running in a JFrame and a GUI I would like to add video playback to on a JPanel.
The code for the which creates video player window is as follows:
private final JFrame vidFrame;
private final EmbeddedMediaPlayerComponent vidComp;
//Creates JPanel for video player
public Video() {
vidFrame = new JFrame("VLC video test");
vidFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
vidFrame.setLocation(100, 100);
vidFrame.setSize(800, 800);
vidComp = new EmbeddedMediaPlayerComponent();
//This is the point where I am trying to add the video player to the GUI
MainWindow.vidPanel.add(vidComp);
vidFrame.add(vidComp);
vidFrame.setVisible(true);
}
And this is the panel I'm trying to add the player to:
JPanel vidPanel = new JPanel();
vidPanel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
vidPanel.setBounds(10, 11, 532, 400);
contentPane.add(vidPanel);
I get the error message: "vidPanel cannot be resolved or is not a field"
Does anyone know how I can rectify this?