WHITE PAPERS  |  PRICING  |  DOWNLOADS

 

username

password

 

 

 

 

 

 

 

 

 

 

  Desktop Edition Details  

 

  > Features  

  > Key Benefits  

  > Screenshots  

  > Standards Supported  

  > Pricing  

  > Download Now

 

 

  Developer Resources  

 

  > API Documentation  

  > Developers Guide  

  > Code Examples  

  > Updated Builds  

  > Technical Articles  

 

 

 

 

 

Jump to:

General WebRenderer Functions

  WebRenderer example code base.

 

Advanced WebRenderer functions

 

Application test examples

 

Deploying WebRenderer

WebRenderer DOM

  

  

 

Blocking Popup windows with WebRenderer

 

 

 

Blocking Popup windows

Popup windows are managed through the IBrowserCanvas WindowListener. Through utilizing the WindowListener popup windows can be created, destroyed, customized etc based upon parameters such as the popup windows URL.

browser.addWindowListener( new com.webrenderer.event.WindowAdapter() {
        public void onNewWindow( com.webrenderer.event.WindowEvent e ) {

                // Block any Popups from myurl.com
                if(!e.getURL().equals("www.myurl.com")) {
                        // Create a parent JFrame for the popup
                        final JFrame popup = new JFrame( "Popup" );
                        // The browser that the popup content will display within
                        IBrowserCanvas browserPopup = e.getPopupBrowser();

                        // Adding a resize listener to the popup window
                        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() );
                        // Destroy the JFrame when the popup window is closed
                        popup.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); popup.setVisible( true );
                }
        }
});


  top

 

 

 Sun, Sun Microsystems, and the Sun Logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries 

Privacy Policy  |   Disclaimer