org.argouml.swingext
Class PopupButton

java.lang.Object
  |
  +--ModalButton
        |
        +--org.argouml.swingext.PopupButton
Direct Known Subclasses:
ZoomSliderButton

public class PopupButton
extends ModalButton

A button that displays a popup when pressed. The popup can contain any Component.

See Also:
Serialized Form

Field Summary
private  java.awt.Component _component
          The popup component.
 
Constructor Summary
PopupButton()
          Constructs a new PopupButton with no popup assigned.
PopupButton(java.awt.Component c, javax.swing.Icon icon)
          Constructs a new PopupButton with the specified popup component and button icon
 
Method Summary
 java.awt.Component getPopupComponent()
          Returns the component that is displayed within the popup.
 void setIcon(javax.swing.Icon icon)
          Sets the button icon.
 void setPopupComponent(java.awt.Component c)
          Sets the component to be displayed within the popup.
protected  void showPopup()
          Called when the user clicks the button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_component

private java.awt.Component _component
The popup component.

Constructor Detail

PopupButton

public PopupButton()
Constructs a new PopupButton with no popup assigned.


PopupButton

public PopupButton(java.awt.Component c,
                   javax.swing.Icon icon)
Constructs a new PopupButton with the specified popup component and button icon

Parameters:
c - the component to popup
icon - the button icon
Method Detail

getPopupComponent

public java.awt.Component getPopupComponent()
Returns the component that is displayed within the popup.

Returns:
the popup component

setPopupComponent

public void setPopupComponent(java.awt.Component c)
Sets the component to be displayed within the popup.

Parameters:
c - the new popup component

setIcon

public final void setIcon(javax.swing.Icon icon)
Sets the button icon. Overridden to automatically add a drop down icon to the right of the icon image.

Parameters:
icon - the new button icon

showPopup

protected void showPopup()
Called when the user clicks the button. This method will show the popup component in a popup menu. Subclasses can override this method to perform actions before the popup is shown.



ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook