Class DropDownButtonFactory
java.lang.Object
org.openide.awt.DropDownButtonFactory
Factory creating buttons with a small arrow icon that shows a popup menu when clicked.
The default button behavior hasn't changed except that the button doesn't
display any text, just the icon.
- Since:
- 6.11
- Author:
- S. Aubrecht
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUse this property name to assign or remove popup menu to/from buttons created by this factory, e.g. -
Method Summary
Modifier and TypeMethodDescriptionstatic JButtoncreateDropDownButton(Icon icon, JPopupMenu dropDownMenu) Creates JButton with a small arrow that shows the provided popup menu when clicked.static JToggleButtoncreateDropDownToggleButton(Icon icon, JPopupMenu dropDownMenu) Creates JToggleButton with a small arrow that shows the provided popup menu when clicked.
-
Field Details
-
PROP_DROP_DOWN_MENU
Use this property name to assign or remove popup menu to/from buttons created by this factory, e.g.dropDownButton.putClientProperty( PROP_DROP_DOWN_MENU, new JPopupMenu() )The property value must beJPopupMenu, removing this property removes the arrow from the button.- See Also:
-
-
Method Details
-
createDropDownButton
Creates JButton with a small arrow that shows the provided popup menu when clicked.- Parameters:
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.- Returns:
- A button that is capable of displaying an 'arrow' in its icon to open a popup menu.
-
createDropDownToggleButton
Creates JToggleButton with a small arrow that shows the provided popup menu when clicked.- Parameters:
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.- Returns:
- A toggle-button that is capable of displaying an 'arrow' in its icon to open a popup menu.
-