PageRenderTime 422ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Win95NT/JDK 1.1.4/JDK 1.1.4 Documentation/api/java.awt.MenuBar.html

https://github.com/rortian/oldjava
HTML | 326 lines | 324 code | 0 blank | 2 comment | 0 complexity | a3bde1dd71de38b1a659a93b1491462c MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <!--NewPage-->
  3. <html>
  4. <head>
  5. <!-- Generated by javadoc on Sat Aug 30 15:44:46 PDT 1997 -->
  6. <title>
  7. Class java.awt.MenuBar
  8. </title>
  9. </head>
  10. <body>
  11. <a name="_top_"></a>
  12. <pre>
  13. <a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-java.awt.html">This Package</a> <a href="java.awt.Menu.html#_top_">Previous</a> <a href="java.awt.MenuComponent.html#_top_">Next</a> <a href="a-names.html">Index</a></pre>
  14. <hr>
  15. <h1>
  16. Class java.awt.MenuBar
  17. </h1>
  18. <pre>
  19. <a href="java.lang.Object.html#_top_">java.lang.Object</a>
  20. |
  21. +----<a href="java.awt.MenuComponent.html#_top_">java.awt.MenuComponent</a>
  22. |
  23. +----java.awt.MenuBar
  24. </pre>
  25. <hr>
  26. <dl>
  27. <dt> public class <b>MenuBar</b>
  28. <dt> extends <a href="java.awt.MenuComponent.html#_top_">MenuComponent</a>
  29. <dt> implements <a href="java.awt.MenuContainer.html#_top_">MenuContainer</a>
  30. </dl>
  31. The <code>MenuBar</code> class encapsulates the platform's
  32. concept of a menu bar bound to a frame. In order to associate
  33. the menu bar with a <code>Frame</code> object, call the
  34. frame's <code>setMenuBar</code> method.
  35. <p>
  36. <A NAME="mbexample"></A><!-- target for cross references -->
  37. This is what a menu bar might look like:
  38. <p>
  39. <img src="images-awt/MenuBar-1.gif"
  40. ALIGN=center HSPACE=10 VSPACE=7>
  41. <p>
  42. A menu bar handles keyboard shortcuts for menu items, passing them
  43. along to its child menus.
  44. (Keyboard shortcuts, which are optional, provide the user with
  45. an alternative to the mouse for invoking a menu item and the
  46. action that is associated with it.)
  47. Each menu item can maintain an instance of <code>MenuShortcut</code>.
  48. The <code>MenuBar</code> class defines several methods,
  49. <A HREF="#shortcuts"><code>shortCuts</code></A> and
  50. <A HREF="#getShortcutMenuItem"><code>getShortcutMenuItem</code></A>
  51. that retrieve information about the shortcuts a given
  52. menu bar is managing.
  53. <p>
  54. <dl>
  55. <dt> <b>See Also:</b>
  56. <dd> <a href="java.awt.Frame.html#_top_">Frame</a>, <a href="java.awt.Frame.html#setMenuBar(java.awt.MenuBar)">setMenuBar</a>, <a href="java.awt.Menu.html#_top_">Menu</a>, <a href="java.awt.MenuItem.html#_top_">MenuItem</a>, <a href="java.awt.MenuShortcut.html#_top_">MenuShortcut</a>
  57. </dl>
  58. <hr>
  59. <a name="index"></a>
  60. <h2>
  61. <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
  62. </h2>
  63. <dl>
  64. <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
  65. <a href="#MenuBar()"><b>MenuBar</b></a>()
  66. <dd> Creates a new menu bar.
  67. </dl>
  68. <h2>
  69. <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
  70. </h2>
  71. <dl>
  72. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  73. <a href="#add(java.awt.Menu)"><b>add</b></a>(Menu)
  74. <dd> Adds the specified menu to the menu bar.
  75. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  76. <a href="#addNotify()"><b>addNotify</b></a>()
  77. <dd> Creates the menu bar's peer.
  78. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  79. <a href="#countMenus()"><b>countMenus</b></a>()
  80. <dd>
  81. <b>Deprecated.</b>
  82. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  83. <a href="#deleteShortcut(java.awt.MenuShortcut)"><b>deleteShortcut</b></a>(MenuShortcut)
  84. <dd> Deletes the specified menu shortcut.
  85. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  86. <a href="#getHelpMenu()"><b>getHelpMenu</b></a>()
  87. <dd> Gets the help menu on the menu bar.
  88. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  89. <a href="#getMenu(int)"><b>getMenu</b></a>(int)
  90. <dd> Gets the specified menu.
  91. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  92. <a href="#getMenuCount()"><b>getMenuCount</b></a>()
  93. <dd> Gets the number of menus on the menu bar.
  94. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  95. <a href="#getShortcutMenuItem(java.awt.MenuShortcut)"><b>getShortcutMenuItem</b></a>(MenuShortcut)
  96. <dd> Gets the instance of <code>MenuItem</code> associated
  97. with the specified <code>MenuShortcut</code> object,
  98. or <code>null</code> if none has been specified.
  99. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  100. <a href="#remove(int)"><b>remove</b></a>(int)
  101. <dd> Removes the menu located at the specified
  102. index from this menu bar.
  103. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  104. <a href="#remove(java.awt.MenuComponent)"><b>remove</b></a>(MenuComponent)
  105. <dd> Removes the specified menu component from this menu bar.
  106. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  107. <a href="#removeNotify()"><b>removeNotify</b></a>()
  108. <dd> Removes the menu bar's peer.
  109. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  110. <a href="#setHelpMenu(java.awt.Menu)"><b>setHelpMenu</b></a>(Menu)
  111. <dd> Sets the help menu on this menu bar to be the specified menu.
  112. <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
  113. <a href="#shortcuts()"><b>shortcuts</b></a>()
  114. <dd>
  115. Gets an enumeration of all menu shortcuts this menu bar
  116. is managing.
  117. </dl>
  118. <a name="constructors"></a>
  119. <h2>
  120. <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
  121. </h2>
  122. <a name="MenuBar"></a>
  123. <a name="MenuBar()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
  124. <b>MenuBar</b>
  125. <pre>
  126. public MenuBar()
  127. </pre>
  128. <dl>
  129. <dd> Creates a new menu bar.
  130. <p>
  131. </dl>
  132. <a name="methods"></a>
  133. <h2>
  134. <img src="images/methods.gif" width=151 height=38 alt="Methods">
  135. </h2>
  136. <a name="addNotify()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  137. <a name="addNotify"><b>addNotify</b></a>
  138. <pre>
  139. public void addNotify()
  140. </pre>
  141. <dl>
  142. <dd> Creates the menu bar's peer. The peer allows us to change the
  143. appearance of the menu bar without changing any of the menu bar's
  144. functionality.
  145. <p>
  146. </dl>
  147. <a name="removeNotify()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  148. <a name="removeNotify"><b>removeNotify</b></a>
  149. <pre>
  150. public void removeNotify()
  151. </pre>
  152. <dl>
  153. <dd> Removes the menu bar's peer. The peer allows us to change the
  154. appearance of the menu bar without changing any of the menu bar's
  155. functionality.
  156. <p>
  157. <dd><dl>
  158. <dt> <b>Overrides:</b>
  159. <dd> <a href="java.awt.MenuComponent.html#removeNotify()">removeNotify</a> in class <a href="java.awt.MenuComponent.html#_top_">MenuComponent</a>
  160. </dl></dd>
  161. </dl>
  162. <a name="getHelpMenu()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  163. <a name="getHelpMenu"><b>getHelpMenu</b></a>
  164. <pre>
  165. public <a href="java.awt.Menu.html#_top_">Menu</a> getHelpMenu()
  166. </pre>
  167. <dl>
  168. <dd> Gets the help menu on the menu bar.
  169. <p>
  170. <dd><dl>
  171. <dt> <b>Returns:</b>
  172. <dd> the help menu on this menu bar.
  173. </dl></dd>
  174. </dl>
  175. <a name="setHelpMenu(java.awt.Menu)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  176. <a name="setHelpMenu"><b>setHelpMenu</b></a>
  177. <pre>
  178. public synchronized void setHelpMenu(<a href="java.awt.Menu.html#_top_">Menu</a> m)
  179. </pre>
  180. <dl>
  181. <dd> Sets the help menu on this menu bar to be the specified menu.
  182. <p>
  183. <dd><dl>
  184. <dt> <b>Parameters:</b>
  185. <dd> m - the menu to be set as the help menu.
  186. </dl></dd>
  187. </dl>
  188. <a name="add(java.awt.Menu)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  189. <a name="add"><b>add</b></a>
  190. <pre>
  191. public synchronized <a href="java.awt.Menu.html#_top_">Menu</a> add(<a href="java.awt.Menu.html#_top_">Menu</a> m)
  192. </pre>
  193. <dl>
  194. <dd> Adds the specified menu to the menu bar.
  195. <p>
  196. <dd><dl>
  197. <dt> <b>Parameters:</b>
  198. <dd> m - the menu to be added.
  199. <dt> <b>Returns:</b>
  200. <dd> the menu added.
  201. <dt> <b>See Also:</b>
  202. <dd> <a href="#remove(int)">remove</a>, <a href="#remove(java.awt.MenuComponent)">remove</a>
  203. </dl></dd>
  204. </dl>
  205. <a name="remove(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  206. <a name="remove"><b>remove</b></a>
  207. <pre>
  208. public synchronized void remove(int index)
  209. </pre>
  210. <dl>
  211. <dd> Removes the menu located at the specified
  212. index from this menu bar.
  213. <p>
  214. <dd><dl>
  215. <dt> <b>Parameters:</b>
  216. <dd> index - the position of the menu to be removed.
  217. <dt> <b>See Also:</b>
  218. <dd> <a href="#add(java.awt.Menu)">add</a>
  219. </dl></dd>
  220. </dl>
  221. <a name="remove(java.awt.MenuComponent)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  222. <a name="remove"><b>remove</b></a>
  223. <pre>
  224. public synchronized void remove(<a href="java.awt.MenuComponent.html#_top_">MenuComponent</a> m)
  225. </pre>
  226. <dl>
  227. <dd> Removes the specified menu component from this menu bar.
  228. <p>
  229. <dd><dl>
  230. <dt> <b>Parameters:</b>
  231. <dd> m - the menu component to be removed.
  232. <dt> <b>See Also:</b>
  233. <dd> <a href="#add(java.awt.Menu)">add</a>
  234. </dl></dd>
  235. </dl>
  236. <a name="getMenuCount()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  237. <a name="getMenuCount"><b>getMenuCount</b></a>
  238. <pre>
  239. public int getMenuCount()
  240. </pre>
  241. <dl>
  242. <dd> Gets the number of menus on the menu bar.
  243. <p>
  244. <dd><dl>
  245. <dt> <b>Returns:</b>
  246. <dd> the number of menus on the menu bar.
  247. </dl></dd>
  248. </dl>
  249. <a name="countMenus()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  250. <a name="countMenus"><b>countMenus</b></a>
  251. <pre>
  252. public int countMenus()
  253. </pre>
  254. <dl>
  255. <dd><b> Note: countMenus() is deprecated.</b>
  256. <i>As of JDK version 1.1,
  257. replaced by <code>getMenuCount()</code>.</i>
  258. <p>
  259. </dl>
  260. <a name="getMenu(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  261. <a name="getMenu"><b>getMenu</b></a>
  262. <pre>
  263. public <a href="java.awt.Menu.html#_top_">Menu</a> getMenu(int i)
  264. </pre>
  265. <dl>
  266. <dd> Gets the specified menu.
  267. <p>
  268. <dd><dl>
  269. <dt> <b>Parameters:</b>
  270. <dd> i - the index position of the menu to be returned.
  271. <dt> <b>Returns:</b>
  272. <dd> the menu at the specified index of this menu bar.
  273. </dl></dd>
  274. </dl>
  275. <a name="shortcuts()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  276. <a name="shortcuts"><b>shortcuts</b></a>
  277. <pre>
  278. public synchronized <a href="java.util.Enumeration.html#_top_">Enumeration</a> shortcuts()
  279. </pre>
  280. <dl>
  281. <dd> Gets an enumeration of all menu shortcuts this menu bar
  282. is managing.
  283. <p>
  284. <dd><dl>
  285. <dt> <b>Returns:</b>
  286. <dd> an enumeration of menu shortcuts that this
  287. menu bar is managing.
  288. <dt> <b>See Also:</b>
  289. <dd> <a href="java.awt.MenuShortcut.html#_top_">MenuShortcut</a>
  290. </dl></dd>
  291. </dl>
  292. <a name="getShortcutMenuItem(java.awt.MenuShortcut)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  293. <a name="getShortcutMenuItem"><b>getShortcutMenuItem</b></a>
  294. <pre>
  295. public <a href="java.awt.MenuItem.html#_top_">MenuItem</a> getShortcutMenuItem(<a href="java.awt.MenuShortcut.html#_top_">MenuShortcut</a> s)
  296. </pre>
  297. <dl>
  298. <dd> Gets the instance of <code>MenuItem</code> associated
  299. with the specified <code>MenuShortcut</code> object,
  300. or <code>null</code> if none has been specified.
  301. <p>
  302. <dd><dl>
  303. <dt> <b>Parameters:</b>
  304. <dd> s - the specified menu shortcut.
  305. <dt> <b>See Also:</b>
  306. <dd> <a href="java.awt.MenuItem.html#_top_">MenuItem</a>, <a href="java.awt.MenuShortcut.html#_top_">MenuShortcut</a>
  307. </dl></dd>
  308. </dl>
  309. <a name="deleteShortcut(java.awt.MenuShortcut)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
  310. <a name="deleteShortcut"><b>deleteShortcut</b></a>
  311. <pre>
  312. public void deleteShortcut(<a href="java.awt.MenuShortcut.html#_top_">MenuShortcut</a> s)
  313. </pre>
  314. <dl>
  315. <dd> Deletes the specified menu shortcut.
  316. <p>
  317. <dd><dl>
  318. <dt> <b>Parameters:</b>
  319. <dd> s - the menu shortcut to delete.
  320. </dl></dd>
  321. </dl>
  322. <hr>
  323. <pre>
  324. <a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-java.awt.html">This Package</a> <a href="java.awt.Menu.html#_top_">Previous</a> <a href="java.awt.MenuComponent.html#_top_">Next</a> <a href="a-names.html">Index</a></pre>
  325. </body>
  326. </html>