public final class DropDownButtonFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PROP_DROP_DOWN_MENU
Use this property name to assign or remove popup menu to/from buttons created by this factory,
e.g.
|
Modifier and Type | Method and Description |
---|---|
static JButton |
createDropDownButton(Icon icon,
JPopupMenu dropDownMenu)
Creates JButton with a small arrow that shows the provided popup menu when clicked.
|
static JToggleButton |
createDropDownToggleButton(Icon icon,
JPopupMenu dropDownMenu)
Creates JToggleButton with a small arrow that shows the provided popup menu when clicked.
|
static Icon |
getArrowIcon(boolean disabled)
Get a dropdown button icon that is identical to those used in the dropdown buttons returned
by other methods in this class.
|
public static final String PROP_DROP_DOWN_MENU
dropDownButton.putClientProperty( PROP_DROP_DOWN_MENU, new JPopupMenu() )
The property value must be JPopupMenu
, removing this property removes the arrow from the button.public static JButton createDropDownButton(Icon icon, JPopupMenu dropDownMenu)
icon
- The default icon, cannot be nulldropDownMenu
- Popup menu to display when the arrow is clicked. If this parameter is null
then the button doesn't show any arrow and behaves like a regular JButton. It is possible to add
the popup menu later using PROP_DROP_DOWN_MENU client property.public static JToggleButton createDropDownToggleButton(Icon icon, JPopupMenu dropDownMenu)
icon
- The default icon, cannot be nulldropDownMenu
- Popup menu to display when the arrow is clicked. If this parameter is null
then the button doesn't show any arrow and behaves like a regular JToggleButton. It is possible to add
the popup menu later using PROP_DROP_DOWN_MENU client property.public static Icon getArrowIcon(boolean disabled)
disabled
- whether to get a disabled version of the icon or not