Recipe 9.12 Enabling and Disabling Menu Items

     

9.12.1 Problem

You want to disable menu items whose selection is inappropriate.

9.12.2 Solution

To enable and disable menu items, use the MenuItem class's setEnabled method.

9.12.3 Discussion

You can pass a boolean value to the setEnabled method; true enables the item, false disables it.

9.12.4 See Also

Recipe 9.7 on creating a menu system; Recipe 9.8 on creating text menu items; Recipe 9.9 on creating image menu items; Recipe 9.10 on creating radio menu items; Recipe 9.11 on creating menu item accelerators and mnemonics .



Eclipse Cookbook
Inside XML (Inside (New Riders))
ISBN: 596007108
EAN: 2147483647
Year: 2006
Pages: 232
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net