How to create a JPopupMenu

To demonstrate a popup menu we select the JInternalFrame we have created within our JDesktopPane from the tree. Now we activate the toolbar button new JPopupMenu and save the newly created Component. After that we select one of the menu items of the already created JMenu from the tree press Copy Component in the toolbar, then select our JPopupMenu in the tree and press Paste Component in the toolbar. Thereafter check the frame, activate the internal frame, press the mouse-popup button and you will see the result.

While doing this you will get some warnings on the Warning Panel. This is because we copied the Components without changing their names. As these names become the variable names when creating the source code, we are warned here. So if you later on wish to address these Components within your Java code, change their Name property by opening them in the editor via the Edit ... button from the toolbar. This will be necessary for the menu items, but not for the separator, because it will scarcely be manipulated by the program.