请查看附件中的图片。在最大化后将窗口调整为原始尺寸时,vlcj媒体组件会隐藏控制按钮。
public class PlayerVLCPanel extends JPanel {
private EmbeddedMediaPlayerComponent playerComponent;
public PlayerVLCPanel() {
this.playerComponent = ComponentStore.getCameraStreamer();
setLayout(new BorderLayout());
add(this.playerComponent.getVideoSurface(), BorderLayout.CENTER);
}
}
public class CameraJobControlPanel extends JPanel {
public CameraJobControlPanel() {
DesignGridLayout layout = new DesignGridLayout(this);
layout.row().grid(expertDnLabel).add(expertDnField);
layout.row().right().add(startCamButton, stopCamButton, startLazerButton, stopLazerButton).fill();
}
}
public class MainPlayerContainer extends JPanel {
public MainPlayerContainer() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setBorder(new EmptyBorder(3, 3, 3, 3));
add(topRegion()); // contains PlayerVLCPanel
add(bottomRegion()); // contains the Control buttons
}
}
最后,
JFrame frame = new JFrame("vlcj Testing");
frame.add(new MainPlayerContainer());
frame.setLocation(100, 100);
frame.setSize(1050, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
如何防止此行为?提前谢谢。