com.webrenderer.event
Interface WindowListener

All Superinterfaces:
java.util.EventListener
All Known Implementing Classes:
WindowAdapter

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.validate(); 
                 popup.repaint(); 
             } 
         }); 

         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

onNewWindow

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

Parameters:
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.

onWindowDestroy

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.


onWindowResize

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