public static JComponent createContent() {
JPanel contentPane = new JPanel(new BorderLayout());
JPanel webBrowserPanel = new JPanel(new BorderLayout());
webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
final JWebBrowser webBrowser = new JWebBrowser();
webBrowser.setBarsVisible(false);
webBrowser.setStatusBarVisible(true);
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
contentPane.add(webBrowserPanel, BorderLayout.CENTER);
JPanel configurationPanel = new JPanel(new BorderLayout());
configurationPanel.setBorder(BorderFactory.createTitledBorder("Configuration"));
final JTextArea configurationTextArea = new JTextArea(
"<html>" + LS +
" <body>" + LS +
" <h1>Some header</h1>" + LS +
" <p>A paragraph with a <a href=\"http://www.google.com\">link</a>.</p>" + LS +
" </body>" + LS +
"</html>");
JScrollPane scrollPane = new JScrollPane(configurationTextArea);
Dimension preferredSize = scrollPane.getPreferredSize();
preferredSize.height += 20;
scrollPane.setPreferredSize(preferredSize);
configurationPanel.add(scrollPane, BorderLayout.CENTER);
JPanel configurationButtonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
JButton setContentButton = new JButton("Set Content");
setContentButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
webBrowser.setHTMLContent(configurationTextArea.getText());
}
});
configurationButtonPanel.add(setContentButton);
configurationPanel.add(configurationButtonPanel, BorderLayout.SOUTH);
contentPane.add(configurationPanel, BorderLayout.NORTH);