This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes AWT question from javaprepare: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "AWT question from javaprepare:" Watch "AWT question from javaprepare:" New topic
Author

AWT question from javaprepare:

geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
Which of these classes can be added to a Frame component. Select all correct answers.
1.Menu
2.Button
3.PopupMenu
4.Window
5.List
Acc.to javaprepare,the answer is 2,3,5.
But,i think it's 1,2,3,5.All except Window,in this list can be added to a Frame.Pl.clarify.
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Check the API Spec. You can add anything that extends Component to a Frame. Menu, however, extends MenuComponent, so it can't be added.
Corey
[ May 29, 2002: Message edited by: Corey McGlone ]

SCJP Tipline, etc.
Swati Gupta
Ranch Hand

Joined: May 28, 2002
Posts: 106
I thing that we can use MenuBar with Frame using setMenuBar and we should add menu to menubar.
Please correct if I am wrong.
geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
Acc.to mughal(chp 12):
A frame is an optionally user resizable and movable top level window ,that can have a title-bar,an icon and menus.
Pl.clarify.
geetha nagarajan
Ranch Hand

Joined: Jul 13, 2001
Posts: 94
Ya,i think we can add menubars to Frame ,using methods like setMenuBar().
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
I'm sorry, I accidentally pulled that from the Window API Spec, rather than the Frame API Spec. However, you still can't "add" a menu to a Frame. The add methods take Components, not MenuComponents. Rather you use the setMenuBar method to place a menu into the Frame.
The original question asks, speicifically, which ones can be "added" to the frame. A menu can not be.
I hope that helps,
Corey
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AWT question from javaprepare:
 
Similar Threads
Question by topic !
Is "strictfp" a keyword?
javaprepare: can Menu class be added to a Frame component??
Prep Material for scjp 1.4
close pop up window and redirect to parent window in struts2