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");
}
}
});
当我在JPanel上双击屏幕(EmbeddedMediaPlayerComponent)时,我想打印消息。我认为这段代码没有错误,但是它不会打印“成功”,希望您能对我有所帮助。谢谢。
答案 0 :(得分:2)
尝试将鼠标侦听器添加到视频表面组件:
mediaPlayerComponent.videoSurfaceComponent().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("click");
}
});
在某些旧版本中,该方法称为getVideoSurface()
。