|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.gui.PopupHandler
public class PopupHandler
Create the popup handler.
The 'processMenuItem' method may be overridden or the 'setMenuItemActionListener' method may be used to process menu item actions.
Constructor Summary | |
---|---|
PopupHandler(javax.swing.JPopupMenu popupMenu,
java.awt.Component parent)
Create the popup handler. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Action listener. |
void |
addButton(javax.swing.AbstractButton button)
Add a button. |
javax.swing.JMenuItem |
addMenuItem(javax.swing.JMenuItem menuItem)
Adds the menu item. |
javax.swing.JMenuItem |
addMenuItem(java.lang.String text)
Adds a menu item with the specified text. |
void |
addMenuItems(java.lang.String[] text)
Adds menu items with the specified text. |
void |
addSeparator()
Appends a new separator at the end of the menu. |
protected int |
calculatePopupMenuY(java.awt.Component invoker)
Calculate the popup menu Y location. |
protected javax.swing.JMenuItem |
createMenuItem(java.lang.String text)
Create the menu item with the specified text. |
protected int |
getHeight(java.awt.Component component)
Get the component height. |
java.awt.event.ActionListener |
getMenuItemActionListener()
Get the menu item action listener. |
protected int |
getPopupMenuY(java.awt.Component invoker)
Get the popup menu Y location. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) 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 |
processMenuItem(javax.swing.JMenuItem menuItem)
Process the menu item. |
boolean |
removeButton(javax.swing.AbstractButton button)
Remove a button. |
java.awt.event.ActionListener |
removeMenuItemActionListener()
Remove the menu item action listener. |
void |
setMenuItemActionListener(java.awt.event.ActionListener l)
Set the menu item action listener. |
protected void |
showPopup(java.awt.AWTEvent e)
Show the popup menu if conditions are met. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PopupHandler(javax.swing.JPopupMenu popupMenu, java.awt.Component parent)
popupMenu
- the popup menu.parent
- the component in which the popup menu menu is to be
displayed.Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the action event.public void addButton(javax.swing.AbstractButton button)
button
- the button.public javax.swing.JMenuItem addMenuItem(javax.swing.JMenuItem menuItem)
menuItem
- the menu item.
public javax.swing.JMenuItem addMenuItem(java.lang.String text)
text
- the menu item text or null for separator.
public void addMenuItems(java.lang.String[] text)
text
- the array of menu item text or null for separator.public void addSeparator()
protected int calculatePopupMenuY(java.awt.Component invoker)
invoker
- the invoker.
protected javax.swing.JMenuItem createMenuItem(java.lang.String text)
text
- the text.
protected int getHeight(java.awt.Component component)
component
- the component.
public java.awt.event.ActionListener getMenuItemActionListener()
protected int getPopupMenuY(java.awt.Component invoker)
invoker
- the invoker.
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- the mouse event.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- the mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- the mouse event.public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- the mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- the mouse event.protected void processMenuItem(javax.swing.JMenuItem menuItem)
menuItem
- the menu item.public boolean removeButton(javax.swing.AbstractButton button)
button
- the button.
public java.awt.event.ActionListener removeMenuItemActionListener()
public void setMenuItemActionListener(java.awt.event.ActionListener l)
l
- the menu item action listener.protected void showPopup(java.awt.AWTEvent e)
e
- the event or null if none.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |