|
||||||||||||||
|
|
|||||||||||||
|
|
|||
|
|||
|
|||
|
Handling popup windows | ||
|
|
|
|
|
|
Popup windows can be both useful and irritating. Some internet sites rely on the use of popup windows to capture critical information, whilst other popups can be used to display advertising. WebRenderer has factored both of these issues into account opening up methods to both block and customize popup windows. | |
|
|
|
|
|
|
Blocking all popup windows | |
|
|
|
|
|
|
IBrowserCanvas
browser = BrowserFactory.spawnMozilla(); |
|
|
|
|
|
|
|
Customizing popup windows |
|
|
|
|
|
|
|
browser.addWindowListener(new WindowAdapter() { public void
onNewWindow(WindowEvent e) { //
This is the popup windows JFrame which can be customized final JFrame popup = new JFrame("Popup");
//
Get the WebRenderer popup window instance IBrowserCanvas browserPopup = e.getPopupBrowser();
browserPopup.addWindowListener(new WindowAdapter() { public
void onWindowResize (WindowEvent e) { //
Setting the size of the popup when the popup windows size event
is fired popup.setSize(e.
getWidth(),e.getHeight()); } });
//
Add the WebRenderer browser popup to the popup JFrame popup.getContentPane().add(BorderLayout.CENTER,
browserPopup.getComponent()); //
Adding a listener to the JFrame that destroys the browser popup
window instance on exit popup.addWindowListener(new
java.awt.event.WindowAdapter() { public
void windowClosing(WindowEvent evt) { //
Destroying the WebRenderer popup browser - essential to allow
additional popups to open BrowserFactory.destroyBrowser(browser); popup.dispose(); } }); popup.setVisible(true); } |
|
|
|
Copyright � JadeLiquid Software - www.jadeliquid.com |