Rogue Wave JViews Framework Code Example: Pop-up Menu
Description
![]() |
This sample shows how to use an IlvPopupMenuManager
instance to attach pop-up menus to IlvGraphic
objects.
How to Use the Code Example
- The applet displays a manager containing graphic objects.
- Pop-up menus are associated with the graphic objects.
- The checkbox at the top of the applet is used to enable or disable pop-up menus globally.
- Clicking on a graphic object with the pop-up trigger displays that objects pop-up menu. The pop-up trigger is usually the mouse right-click event.
- Clicking the white space with the pop-up trigger displays the main manager pop-up menu. This menu allows the user to zoom in or out of the view.
- Alternatively, you can trigger the pop-up menu by keyboard. Select a graphic object and press the F1 key or the P key to display the pop-up menu. This might work however only when the sample runs as application outside the browser, because for applets inside the browser, the browser might consume those key events.
- Four kinds of pop-up menus are shown:
- A basic menu containing simple actions,
- A menu that contains additional radio buttons in the menu,
- A complex menu that contains menu items with icons and tooltips,
- A complex menu that can be internationalized.
- Actions associated with pop-up menu items are in this sample for demo purposes only.
- Buttons on the top of the applet are used for the following:
-
Sets the view in Pan mode. Pan the view by dragging the image.
-
Sets Selection mode. Select, move, and edit objects.
-
Zoom by selecting an area that should be magnified.
-
Zoom in.
-
Zoom out.
-
Make the entire image visible.
-
How to Run the Code Example as an Application
This code example can also be run as an application. The installation directory contains an executable JAR file, simplepopupmenu.jar
, that allows you to execute the code example with a double click from a file browser. Note that if you are using Internet Explorer, you can open the installation directory and execute the JAR file from the browser. This technique may not work in other Web browsers.
Alternatively, you can run the code example application from the command line. First check that the Ant utility is properly configured. If not, see the instructions on how to configure Ant for Rogue Wave JViews.
Then, go to the installation directory of the code example and type:
ant run
Topics Covered
- Pop-up Menu on Graphic Objects
Installation Directory
The Pop-up Menu code example is installed here.
Classes Involved
- ilog.views.swing.IlvPopupMenuManager
- ilog.views.swing.IlvPopupMenuContext
- ilog.views.swing.IlvSimplePopupMenu
- ilog.views.util.IlvLocaleUtil
- ilog.views.util.IlvResourceUtil
- ilog.views.graphic.IlvZoomableLabel
- ilog.views.IlvGraphic
- ilog.views.IlvApplyObject
- ilog.views.IlvManager
- ilog.views.IlvManagerView
- ilog.views.swing.IlvJScrollManagerView
- ilog.views.swing.IlvJManagerViewControlBar