User    Pass    













Key Benefits




Standards Supported




Download Now


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




WebRenderer JMenus




Using JMenus with WebRenderer  - click here to download complete JMenu example code


Java JMenus are particularly useful in creating default context menus for right-click activation.

We have constructed a small example application demonstrating the use of JMenus and WebRenderer. When the menu items are clicked a message will be output to the command line from each menu item.

The core pieces of the code are as follows:


             IBrowserCanvas browser = BrowserFactory.spawnMozilla();
             * Disabling the default context menu right-click menu)

           JPopupMenu menu = new JPopupMenu("Context Menu");
           JMenuItem menuItem1 = new JMenuItem("Menu Item 1");
           JMenuItem menuItem2 = new JMenuItem("Menu Item 2");
           JMenuItem menuItem3 = new JMenuItem("Menu Item 3");
            * Making the menu heavyweight - this prevents the menu going behind
            * the canvas. This is a bug with Swing menus,other Swing components do
            * not have this issue.
           //Nesting a MouseListener for the WebRenderer browser
           browser.addMouseListener(new MouseAdapter() {
                       public void onMouseDown(MouseEvent e) {
                                //Check if it is a right click
                                if (e.getModifiers() == 4) {
                                        //If it is a right click then show the menu
int x = e.getX();
                                        int y = e.getY();
                                        menu.show(browser.getCanvas(), x, y);

                                } else {

Core code
Making the PopupMenu a heavyweight component is essential to ensure that the component shows above WebRenderer. setLightWeightPopupEnabled(false) sets the popup menu to heavyweight and has the correct Z-Order.



Millions of deployments and counting.. Users of JadeLiquid's tools can be found in every corner of the Earth




 > Enabling Flash in WebRenderer - Article
 > Browser Zoom Effect using WebRenderer - Article
 > Applet deployment techniques - Article
 > WebRenderer core features on display! - Article
   Additional News  
 > Enabling HTML 5 WebSockets in WebRenderer - Blog
 > 64bit WebRenderer deployment with Web Start - Blog
 > Deploying WebRenderer Server Edition in Tomcat - Blog
 > WebRenderer 6 adds performance text search - Blog


 Java and the Java Logo are trademarks or registered trademarks of Oracle Corporation in the United States and other countries 

Privacy Policy  |   Disclaimer