public class CustomMenuItem
  Comment     Returned-by     Constructor-argument     Method-argument     Field-type     Type-bound     Links  

A MenuItem that allows for arbitrary nodes to be embedded within it, by assigning a Node to the content property. CustomMenuItem attempts to make arbitrary nodes appear more natural in the Menu. For example, you automatically get hover highlighting when the user hovers their mouse over the node (or navigates to it using keyboard or other alternate means).

A useful property of this class is hideOnClick. This boolean specifies whether the CustomMenuItem will be automatically hidden should the user click within the bounds of the CustomMenuItem. This is of particular use when the node inside this CustomMenuItem is a control that requires user interaction, as by setting the hideOnClick property to false means the user can interact with it without the menu hiding. Note that by default hideOnClick is true.

An example of how to use CustomMenuItem is shown below.

CustomMenuItem customMenuItem = new CustomMenuItem(new Slider());

If this CustomMenuItem, with the Slider within it, is placed in a menu, you'll be presented with a slider that is horizontally centered when the menu is visible, and interacting with the slider will not result in the menu disappearing.

extends MenuItem

See also:
MenuItem, Menu

Since:  JavaFX 2.0