com.isti.util.menu
Class IstiMenuPopper

java.lang.Object
  extended by com.isti.util.menu.IstiMenuPopper
All Implemented Interfaces:
java.awt.event.MouseListener, java.util.EventListener

public class IstiMenuPopper
extends java.lang.Object
implements java.awt.event.MouseListener

IstiMenuPopper stores a reference to a Component and a PopupMenu. IstiMenuPopper registers itself to listen for MouseEvents on the Component, and when a right-mouse-click occurs, displays the associated popup menu.


Constructor Summary
IstiMenuPopper(java.lang.Object popupMenu)
          Creates the interface between a Component and a PopupMenu.
 
Method Summary
 IstiMenuPopper add(java.awt.Component component)
          Adds the component to the menu popper.
static IstiMenuPopper createMenuPopper(javax.swing.JPopupMenu popupMenu)
          Creates the interface between a JComponent and a JPopupMenu.
static IstiMenuPopper createMenuPopper(javax.swing.JPopupMenu popupMenu, javax.swing.JComponent component)
          Creates the interface between a JComponent and a JPopupMenu.
protected static IstiMenuPopper createMenuPopper(java.lang.Object popupMenu, java.awt.Component component)
          Creates the interface between a Component and a PopupMenu.
static IstiMenuPopper createMenuPopper(java.awt.PopupMenu popupMenu)
          Creates the interface between a Component and a PopupMenu.
static IstiMenuPopper createMenuPopper(java.awt.PopupMenu popupMenu, java.awt.Component component)
          Creates the interface between a Component and a PopupMenu.
 boolean isEnabled()
          Determines whether this popup menu is enabled.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Displays up a popup menu when right mouse click occurs.
 void setEnabled(boolean enabled)
          Sets whether or not this popup menu is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IstiMenuPopper

public IstiMenuPopper(java.lang.Object popupMenu)
Creates the interface between a Component and a PopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
See Also:
createMenuPopper
Method Detail

createMenuPopper

public static IstiMenuPopper createMenuPopper(java.awt.PopupMenu popupMenu)
Creates the interface between a Component and a PopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
Returns:
the menu popper or null if error.
See Also:
add

createMenuPopper

public static IstiMenuPopper createMenuPopper(java.awt.PopupMenu popupMenu,
                                              java.awt.Component component)
Creates the interface between a Component and a PopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
component - the component that will invoke the popup menu.
Returns:
the menu popper or null if error.
See Also:
add

createMenuPopper

public static IstiMenuPopper createMenuPopper(javax.swing.JPopupMenu popupMenu)
Creates the interface between a JComponent and a JPopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
Returns:
the menu popper or null if error.
See Also:
add

createMenuPopper

public static IstiMenuPopper createMenuPopper(javax.swing.JPopupMenu popupMenu,
                                              javax.swing.JComponent component)
Creates the interface between a JComponent and a JPopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
component - the component that will invoke the popup menu.
Returns:
the menu popper or null if error.
See Also:
add

createMenuPopper

protected static IstiMenuPopper createMenuPopper(java.lang.Object popupMenu,
                                                 java.awt.Component component)
Creates the interface between a Component and a PopupMenu.

Parameters:
popupMenu - the popup menu that will be displayed.
component - the component that will invoke the popup menu.
Returns:
the menu popper or null if error.
See Also:
add

add

public IstiMenuPopper add(java.awt.Component component)
Adds the component to the menu popper. IstiMenuPopper registers itself to listen for MouseEvents on the Component, and when a right-mouse-click occurs, displays the associated popup menu.

Parameters:
component - the component that will invoke the popup menu.
Returns:
the menu popper.

isEnabled

public boolean isEnabled()
Determines whether this popup menu is enabled.

Returns:
true if the popup menu is enabled.
See Also:
setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets whether or not this popup menu is enabled.

Parameters:
enabled - true if the popup menu is enabled.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Displays up a popup menu when right mouse click occurs.

Parameters:
e - the mouse event