|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.MouseAdapter
com.jgoodies.uifextras.util.PopupAdapter
public abstract class PopupAdapter
A MouseListener that minimizes the effort required to add a JPopupMenu to a JComponent. Handles mouse pressed and mouse released events and shows the popup menu if the event indicates a popupTrigger. The JPopupMenu is either rebuilt dynamically or lazily created and reused.
TODO: Consider using the Look&Feel dependent popup trigger check
in JPopupMenu.isPopupTrigger(java.awt.event.MouseEvent)
.
See also the commented code in #popupMenuIfTriggered
.
Constructor Summary | |
---|---|
PopupAdapter()
Creates a PopupAdapter that rebuilds its popup menu everytime. |
|
PopupAdapter(boolean reusePopupMenu)
Creates a PopupAdapter with the specified reuse policy. |
Method Summary | |
---|---|
protected abstract JPopupMenu |
buildPopupMenu(MouseEvent e)
Builds and returns this adapter's popup menu. |
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
Methods inherited from class java.awt.event.MouseAdapter |
---|
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PopupAdapter()
public PopupAdapter(boolean reusePopupMenu)
reusePopupMenu
- true to lazily create and reuse the popup,
false to rebuild the popup everytimeMethod Detail |
---|
protected abstract JPopupMenu buildPopupMenu(MouseEvent e)
e
- the MouseEvent that initiated the popup menu build processpublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |