add(webBrowserPanel, BorderLayout.CENTER);
// Add the listeners
testHeaderButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
webBrowserPanel.removeAll();
JWebBrowser webBrowser = new JWebBrowser();
webBrowser.setBarsVisible(false);
WebBrowserNavigationParameters parameters = new WebBrowserNavigationParameters();
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put("User-agent", "Native Swing Browser");
headersMap.put(testHeaderKeyTextField.getText(), testHeaderValueTextField.getText());
parameters.setHeaders(headersMap);
// Let's generate the page with the resulting HTTP headers dynamically.
webBrowser.navigate(WebServer.getDefaultWebServer().getDynamicContentURL(NavigationParameters.this.getClass().getName(), "header-viewer.html"), parameters);
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
webBrowserPanel.revalidate();
webBrowserPanel.repaint();
}
});
testPostDataButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
webBrowserPanel.removeAll();
JWebBrowser webBrowser = new JWebBrowser();
webBrowser.setBarsVisible(false);
WebBrowserNavigationParameters parameters = new WebBrowserNavigationParameters();
Map<String, String> postDataMap = new HashMap<String, String>();
postDataMap.put("short_desc_type", "allwordssubstr");
postDataMap.put("short_desc", testPostDataTextField.getText());
postDataMap.put("bug_status", "NEW");
postDataMap.put("product", "Platform");
postDataMap.put("component", "SWT");
parameters.setPostData(postDataMap);
webBrowser.navigate("https://bugs.eclipse.org/bugs/buglist.cgi", parameters);
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
webBrowserPanel.revalidate();
webBrowserPanel.repaint();
}
});