102
Java JPopupMenu
PopupMenu can be dynamically popped up at specific position within a component. It inherits the JComponent class.
JPopupMenu class declaration
Let’s see the declaration for javax.swing.JPopupMenu class.
Commonly used Constructors:
Constructor | Description |
---|---|
JPopupMenu() | Constructs a JPopupMenu without an “invoker”. |
JPopupMenu(String label) | Constructs a JPopupMenu with the specified title. |
Java JPopupMenu Example
Output:
Java JPopupMenu Example with MouseListener and ActionListener
Output:
Next TopicJava JCheckBoxMenuItem