MouseListener 似乎不适用于 EmbeddedMediaPlayerComponent
MouseListener seems to doesn't work on EmbeddedMediaPlayerComponent
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) 时打印消息我认为这段代码没有错误,但它不打印 "success" 希望你能帮助我。谢谢。
尝试将鼠标监听器添加到视频表面组件:
mediaPlayerComponent.videoSurfaceComponent().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("click");
}
});
在一些旧版本中,该方法称为 getVideoSurface()
。
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) 时打印消息我认为这段代码没有错误,但它不打印 "success" 希望你能帮助我。谢谢。
尝试将鼠标监听器添加到视频表面组件:
mediaPlayerComponent.videoSurfaceComponent().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("click");
}
});
在一些旧版本中,该方法称为 getVideoSurface()
。