47 * When a menu is visible, in most use cases, the user can select one menu item
48 * before the menu goes back to its hidden state. This means the menu is a good
49 * place to put important functionality that does not necessarily need to be
50 * visible at all times to the user.
51 * <p>
52 * Menus are typically placed in a {@link MenuBar}, or as a submenu of another Menu.
53 * If the intention is to offer a context menu when the user right-clicks in a
54 * certain area of their user interface, then this is the wrong control to use.
55 * This is because when Menu is added to the scenegraph, it has a visual
56 * representation that will result in it appearing on screen. Instead,
57 * {@link ContextMenu} should be used in this circumstance.
58 * <p>
59 * Creating a Menu and inserting it into a MenuBar is easy, as shown below:
60 * <pre><code>
61 * final Menu menu1 = new Menu("File");
62 * MenuBar menuBar = new MenuBar();
63 * menuBar.getMenus().add(menu1);
64 * </code></pre>
65 * <p>
66 * A Menu is a subclass of {@link MenuItem} which means that it can be inserted
67 * into a Menu's {@link #items} ObservableList, resulting in a submenu being created:
68 * <pre><code>
69 * MenuItem menu12 = new MenuItem("Open");
70 * menu1.getItems().add(menu12);
71 * </code></pre>
72 * <p>
73 * The items ObservableList allows for any {@link MenuItem} type to be inserted,
74 * including its subclasses {@link Menu}, {@link MenuItem}, {@link RadioMenuItem}, {@link CheckMenuItem},
75 * {@link CustomMenuItem} and {@link SeparatorMenuItem}. In order to insert an arbitrary {@link Node} to
76 * a Menu, a CustomMenuItem can be used. One exception to this general rule is that
77 * {@link SeparatorMenuItem} could be used for inserting a separator.
78 *
79 * @see MenuBar
80 * @see MenuItem
81 * @since JavaFX 2.0
82 */
83 @DefaultProperty("items")
84 public class Menu extends MenuItem {
85
86 /**
87 * <p>Called when the contextMenu for this menu <b>will</b> be shown. However if the
|
47 * When a menu is visible, in most use cases, the user can select one menu item
48 * before the menu goes back to its hidden state. This means the menu is a good
49 * place to put important functionality that does not necessarily need to be
50 * visible at all times to the user.
51 * <p>
52 * Menus are typically placed in a {@link MenuBar}, or as a submenu of another Menu.
53 * If the intention is to offer a context menu when the user right-clicks in a
54 * certain area of their user interface, then this is the wrong control to use.
55 * This is because when Menu is added to the scenegraph, it has a visual
56 * representation that will result in it appearing on screen. Instead,
57 * {@link ContextMenu} should be used in this circumstance.
58 * <p>
59 * Creating a Menu and inserting it into a MenuBar is easy, as shown below:
60 * <pre><code>
61 * final Menu menu1 = new Menu("File");
62 * MenuBar menuBar = new MenuBar();
63 * menuBar.getMenus().add(menu1);
64 * </code></pre>
65 * <p>
66 * A Menu is a subclass of {@link MenuItem} which means that it can be inserted
67 * into a Menu's {@link #getItems() items} ObservableList, resulting in a submenu being created:
68 * <pre><code>
69 * MenuItem menu12 = new MenuItem("Open");
70 * menu1.getItems().add(menu12);
71 * </code></pre>
72 * <p>
73 * The items ObservableList allows for any {@link MenuItem} type to be inserted,
74 * including its subclasses {@link Menu}, {@link MenuItem}, {@link RadioMenuItem}, {@link CheckMenuItem},
75 * {@link CustomMenuItem} and {@link SeparatorMenuItem}. In order to insert an arbitrary {@link Node} to
76 * a Menu, a CustomMenuItem can be used. One exception to this general rule is that
77 * {@link SeparatorMenuItem} could be used for inserting a separator.
78 *
79 * @see MenuBar
80 * @see MenuItem
81 * @since JavaFX 2.0
82 */
83 @DefaultProperty("items")
84 public class Menu extends MenuItem {
85
86 /**
87 * <p>Called when the contextMenu for this menu <b>will</b> be shown. However if the
|