org.tigris.swidgets

Class PopupButton


public class PopupButton
extends ModalButton

A button that displays a popup when pressed. The popup can contain any Component.
Author:
Jeremy Jones

Constructor Summary

PopupButton()
Constructs a new PopupButton with no popup assigned.
PopupButton(Component c, Icon icon)
Constructs a new PopupButton with the specified popup component and button icon

Method Summary

Component
getPopupComponent()
Returns the component that is displayed within the popup.
void
setIcon(Icon icon)
Sets the button icon.
void
setPopupComponent(Component c)
Sets the component to be displayed within the popup.
protected void
showPopup()
Called when the user clicks the button.

Constructor Details

PopupButton

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

PopupButton

public PopupButton(Component c,
                   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 Details

getPopupComponent

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

setIcon

public final void setIcon(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

setPopupComponent

public void setPopupComponent(Component c)
Sets the component to be displayed within the popup.
Parameters:
c - the new popup component

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.