protected static final int WIDTH = 200;
protected static final int HEIGHT = 200;
public static JComponent createContent() {
JPanel contentPane = new JPanel(new BorderLayout());
JLayeredPane layeredPane = new JLayeredPane();
layeredPane.setOpaque(true);
layeredPane.setBackground(new Color(200, 200, 255));
int layerIndex = 0;
// A flash player
JFlashPlayer flashPlayer = new JFlashPlayer(JFlashPlayer.constrainVisibility());
flashPlayer.setControlBarVisible(false);
flashPlayer.load(SimpleFlashExample.class, "resource/Movement-pointer_or_click.swf");
flashPlayer.setBounds(0, 0, 200, 200);
layeredPane.setLayer(flashPlayer, layerIndex++);
layeredPane.add(flashPlayer);
// A swing panel
JPanel swingPanel = new JPanel();
swingPanel.setBorder(BorderFactory.createTitledBorder("Swing JPanel"));
swingPanel.setBackground(Color.GREEN);
swingPanel.setBounds(200, 100, WIDTH, HEIGHT);
layeredPane.setLayer(swingPanel, layerIndex++);
layeredPane.add(swingPanel);
// A web browser
JWebBrowser webBrowser = new JWebBrowser(JWebBrowser.constrainVisibility());
webBrowser.setBarsVisible(false);
webBrowser.setStatusBarVisible(true);
webBrowser.setHTMLContent(
"<html>" + LS +
" <body>" + LS +
" <h1>A web page</h1>" + LS +
" <p>A paragraph with a <a href=\"http://www.google.com\">link</a>.</p>" + LS +
" </body>" + LS +
"</html>");
webBrowser.setBounds(300, 250, WIDTH, HEIGHT);
layeredPane.setLayer(webBrowser, layerIndex++);
// A swing button
JButton swingButton = new JButton("Swing JButton");
swingButton.setBounds(400, 400, WIDTH, HEIGHT);
layeredPane.setLayer(swingButton, layerIndex++);
layeredPane.add(swingButton);
layeredPane.add(webBrowser);
layeredPane.setPreferredSize(new Dimension(600, 600));
contentPane.add(new JScrollPane(layeredPane), BorderLayout.CENTER);
return contentPane;
}