I also came across this question probably from jxam . I think the given answer is wrong because only Frame class has the method setMenuBar() so we can attach a menu bar only to a Frame. please someone verify me.. [This message has been edited by Nasir Khan (edited November 26, 2000).]
Hi, A menubar can be added only to a Frame. So the answer is TRUE. Menubars cannot be added to a Frame by using the add() method. The method used for adding menubar to a Frame is, setMenubar(menuBar); FYI: You can add only one menu bar to a Frame directly. The reason for not using the add() method for menubar is because the menubar is not a Component like Button,Checkbox etc. Each Frame has an instance variable of type MenuBar. So you set this instance variable by using the setMenuBar() method. - Suresh Selvaraj
Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="http://www.decontconsulting.com" target="_blank" rel="nofollow">www.decontconsulting.com</a>
Originally posted by Bin Zhao: TRUE or FALSE Only Frames can contain menu bars or pull-down menus. I think it is true. But a mock exam's anwser is false. Can anyone clear this?
Bin Zhao, as your question states "Only frames can contain menubar or pull-down menus" my ans for that question is false. explaination ----> mind a "or" is involved in the question. and this is not logical or which we generally used in programming languages . this means here that both of the segment "menubar" & "pulldown menu" should be considered separately and then ans. the first part of this question about menu bar is true that only frames can contain menubar but for "pull-down menu" i want to give some args in that favour. generally people think that pull down menu is a menu which is attatched to frame directly (0 level). but this is not true in this concrens. because a pull down menu is a menu which get down on pull ( or selecting) and probabely you have seen all ready that a popup menu can contain pull down menu's. and no doubt popup menus can be attached to a lot of awt components. so by this way a lot of awt components can contain pull down menus. so second segment is false here that's why entire question returns false here. (this is only my openion in the favour of that ans given by the author of that question containing mock exam.)
This one time, at bandcamp, I had relations with a tiny ad.