JFrame window = new JFrame("Swing Video Player");
JDesktopPane panel = new JDesktopPane();
window.add(panel);
for (int i = files.length - 1; i >= 0; --i) {
File file = files[i];
JInternalFrame frame = new JInternalFrame(file.getName());
panel.add(frame);
frame.setResizable(true);
frame.setClosable(true);
frame.setIconifiable(true);
frame.setMaximizable(true);
frame.setLocation(i * 100, i * 100);
final float alpha = 0.6f;
final VideoPlayer player = new VideoPlayer(file) {
private static final long serialVersionUID = 4925431893247320169L;
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g2d.setColor(Color.BLACK);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.dispose();
}
};
player.setPreferredSize(new Dimension(400, 250));
player.setControlsVisible(true);
player.setOpaque(false);
player.setOpacity(alpha);
Pipeline pipe = player.getMediaPlayer().getPipeline();
if (pipe instanceof PlayBin2) {
((PlayBin2) pipe).setAudioSink(ElementFactory.make("fakesink", "audio"));
}
frame.setOpaque(false);
frame.setContentPane(player);
frame.pack();
frame.setVisible(true);
javax.swing.Timer timer = new javax.swing.Timer(5000 * i, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
player.getMediaPlayer().play();
}
});