Interface WindowListener

All Superinterfaces:
All Known Implementing Classes:

public interface WindowListener
extends java.util.EventListener

WindowListener allows the creation of custom popups.

Example of use:

 browser.addWindowListener( new com.webrenderer.event.WindowAdapter() {
     public void onNewWindow( com.webrenderer.event.WindowEvent e ) { 
         final JFrame popup = new JFrame( "Popup" ); 
         IBrowserCanvas browserPopup = e.getPopupBrowser();

         browserPopup.addWindowListener( new com.webrenderer.event.WindowAdapter() { 
             public void onWindowResize ( com.webrenderer.event.WindowEvent e ) { 
                 popup.setSize( e.getWidth(), e.getHeight() ); 

         popup.getContentPane().add( BorderLayout.CENTER, browserPopup.getCanvas() ); 
         popup.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); 
         popup.setVisible( true ); 

Method Summary
 void onNewWindow(WindowEvent e)
          Invoked when a new window is requested.
 void onWindowDestroy(WindowEvent e)
          Invoked when a window destroyed.
 void onWindowResize(WindowEvent e)
          Invoked when a window resized.

Method Detail


public void onNewWindow(WindowEvent e)
Invoked when a new window is requested.

e - Event.
e.getPopupBrowser() returns the IBrowserCanvas to add to the UI.
e.getWidth() and e.getHeight() return the requested size for the popup, this may change later through a call from onWindowResize(WindowEvent).
When added to an IIEBrowserCanvas you must then add a listener for onWindowResize to size the frame.


public void onWindowDestroy(WindowEvent e)
Invoked when a window destroyed. The web browser has been destroyed by a window.close(). Normal behaviour on this event is to close the frame (or tab) contianing the IBrowserCanvas.


public void onWindowResize(WindowEvent e)
Invoked when a window resized. e.getWidth() and e.getHeight() contain the requested size.