public interface PopupManager
PopupManager
is an interface for the editor component
to inform the editor client to show or hide a context-sensitive
popup menu in response to a user's request. The typical request
for a popup is to right-click in the editor.
The reason for the interface is to provide maximum flexibility to
clients in how them implement their own popup menus. For example,
typical Swing applications will create a JPopupMenu
that is used for the popup menu. As another example, the JDev 5.0
framework uses the ContextMenu
object for handling
popup menus.
In order to display popup menus in your own client applications, follow
the example in the editor demo
application. Basically, you need to build an implementation
of PopupManager
that is responsible for showing or hiding
your popup menus, and register it with the editor pane by calling
in addPopupManager()
BasicEditorPane
. When your showPopup()
method is called, build your popup menus (if necessary), and show them.
When your hidePopup()
method is called, hide your popup
menus.
BasicEditorPane
,
oracle.javatools.editor.demo.MainWindow
Modifier and Type | Method and Description |
---|---|
void |
hidePopup(BasicEditorPane editorPane)
Informs the editor client that the popup menu (if showing) should
now be hidden.
|
void |
showPopup(BasicEditorPane editorPane,
java.awt.event.MouseEvent mouseEvent)
Informs the editor client that the user requested a popup menu in
the given editor pane, at the location specified in the
mouseEvent.
|
void showPopup(BasicEditorPane editorPane, java.awt.event.MouseEvent mouseEvent)
editorPane
- the editorPane that the user request occurred inmouseEvent
- the mouse event describing the location of the
popup request.void hidePopup(BasicEditorPane editorPane)
editorPane
- the editorPane for which the popup should be hidden