EmbeddedMediaPlayerComponent component = new EmbeddedMediaPlayerComponent();
component.setPreferredSize(new Dimension(537, 374));
panel.add(component, BorderLayout.WEST);
component.addMouseListener(new MouseAdapter() {
public void mouseClicked (MouseEvent e) {
if (e.getClickCount() == 2) {
System.out.println("success");
}
}
});
I want to print message when I double click screen (EmbeddedMediaPlayerComponent) on JPanel I think this code has no error but it doesn't print "success" I hope you help me. Thank you.
Try to add the mouse listener to the video surface component:
mediaPlayerComponent.videoSurfaceComponent().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("click");
}
});
In some older versions the method is called getVideoSurface()
.